Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Pressed Item #2

Open
OmarHatem28 opened this issue Apr 17, 2019 · 10 comments
Open

Detect Pressed Item #2

OmarHatem28 opened this issue Apr 17, 2019 · 10 comments

Comments

@OmarHatem28
Copy link

OmarHatem28 commented Apr 17, 2019

Greetings,
I have tried to wrap the children of CircleListScrollView widget with GestureDetector and FlatButton to execute onTap or onPressed callbacks but none of them is getting called.
Also I tried to do the same in ListWheelScrollView and got the same result.
Is there a way to detect the pressed item in the list or just by using onSelectedItemChanged ?

Capture

@sachaarbonel
Copy link

Same problem here with InkWell

@ellis-wang
Copy link

can i initial the wheel with a given start index?

@DenisBogatirov
Copy link
Owner

DenisBogatirov commented May 31, 2019 via email

@Yuiie
Copy link

Yuiie commented Jun 26, 2019

hi guys,
that mean we can't click on the circle ? or there is a ways ?

@DenisBogatirov
Copy link
Owner

I'm afraid that issue with gesture detection are connected with ListWheelScrollView (on which my widget is based on). I've changed my example to use ListWheelScrollView, and didn't get anything from GestureDetector. Here is code

import 'package:flutter/material.dart';

class WheelExample extends StatelessWidget {
  Widget _buildItem(BuildContext context, int i) {
    return GestureDetector(
      onTap: () { print('TAP ON ITEM'); },
          child: Center(
        child: ClipRRect(
          borderRadius: BorderRadius.circular(40),
          child: Container(
            width: 80,
            padding: EdgeInsets.all(20),
            color: Colors.blue[100 * ((i % 8) + 1)],
            child: Center(
              child: Text(
                i.toString(),
              ),
            ),
          ),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Wheel example'),
      ),
      body: SafeArea(
        child: Center(
          child: Container(
            child: ListWheelScrollView.useDelegate(
              itemExtent: 80,
              childDelegate: ListWheelChildBuilderDelegate(
                childCount: 10,
                builder: _buildItem,
              ),
            ),
          ),
        ),
      ),
    );
  }
}


class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: WheelExample(),
    );
  }
}

void main() => runApp(MyApp());

Feel free to open issue on flutter repo.

@spiderion
Copy link

I have the same problem.
Does anyone know any solution?

@abbas-azadi
Copy link

Same problem

@rizzellodavide
Copy link

same problem, list does not let the item in it detect the tap. Any work around?

@marah222
Copy link

Any work around??

@Shashwat-111
Copy link

No solutions yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants