Skip to content

Instantly share code, notes, and snippets.

@salihgueler
Last active January 12, 2019 16:16
Show Gist options
  • Save salihgueler/afaaea88fb25d001b343f66977b2661b to your computer and use it in GitHub Desktop.
Save salihgueler/afaaea88fb25d001b343f66977b2661b to your computer and use it in GitHub Desktop.
ListView.builder(
itemCount: 5,
addSemanticIndexes: false,
semanticChildCount: 3,
itemBuilder: (context, position) {
return MergeSemantics(
child: Semantics(
label: 'Container with 200 width 200 height and red background',
enabled: position == 1 ? true : false,
selected: position == 0 ? true : false,
onTap: () {
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('Item $position Clicked!')));
},
onScrollDown: () {
print('Scroll down happened');
},
child: Container(
margin: EdgeInsets.all(16),
color: Colors.red,
height: 200,
width: 200,
child: Column(
children: <Widget>[
Text('First inside text of item $position'),
BlockSemantics(
child: Text('Second inside text of item $position')),
ExcludeSemantics(
child: Text('Third inside text of item $position')),
Text('Fourth inside text of item $position')
],
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment