Skip to content

Instantly share code, notes, and snippets.

View salihgueler's full-sized avatar
🖖
Aloha

Muhammed Salih Guler salihgueler

🖖
Aloha
View GitHub Profile
void main() {
runApp(
new MaterialApp(
...
// Body part of the screen
body: new FutureBuilder(
future: getMovies(),
builder: (BuildContext context,
AsyncSnapshot<List> snapshot) {
if (!snapshot.hasData)
List<Widget> createMovieCardItem(List<Movie> movies, BuildContext context) {
// Children list for the list.
List<Widget> listElementWidgetList = new List<Widget>();
if (movies != null) {
var lengthOfList = movies.length;
for (int i = 0; i < lengthOfList; i++) {
Movie movie = movies[i];
// Image URL
var imageURL = "https://image.tmdb.org/t/p/w500/" + movie.posterPath;
// List item created with an image of the poster
@salihgueler
salihgueler / SemanticsProperties.csv
Last active October 23, 2024 20:53
SemanticsProperties
property explanation
enabled It represents the subtree or the widget that is used can be either enabled or disabled state.
checked It represents checked state of a widget similar to checkbox.
toggled It represents on/off state of a widget similar to switch.
selected It indicates that this subtree represents a widget that can be in selected/unselected state.
button It represents a button is in this subtree.
header It represents a header is in this subtree
textfield It represents a text field is in the subtree
focused It represents that current node holds the input focus. It's not the same with Accessibility Focus
inMutuallyExclusiveGroup It represents if the node is in a mutually exclusive group. E.g. Radiobutton in radio group.
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
./
/// List tile widget creation with Semantics
return InkWell(
onTap: enabled ? onTap : null,
onLongPress: enabled ? onLongPress : null,
child: Semantics(
selected: selected,
enabled: enabled,
child: SafeArea(
top: false,
bottom: false,
ListView.builder(
itemCount: 5,
itemBuilder: (context, position) {
return ListTile(
enabled: position == 1 ? true : false,
selected: position == 0 ? true : false,
title: Text('Main title for $position item'),
subtitle: Text('Sub title for $position item'),
);
},
ListView.builder(
itemCount: 5,
itemBuilder: (context, position) {
return 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!')));
},
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,
ListView(
addSemanticIndexes: false,
semanticChildCount: 2,
children: const <Widget>[
IndexedSemantics(index: 0, child: Text('First')),
Spacer(),
IndexedSemantics(index: 1, child: Text('Second')),
Spacer(),
],
)
@salihgueler
salihgueler / base_playground.dart
Last active March 4, 2019 21:49
base_playground
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: PathExample(),
),
);
class PathExample extends StatelessWidget {
@override