This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<ListItem> list; | |
@override | |
void initState() { | |
super.initState(); | |
WidgetsBinding.instance.addPostFrameCallback((_) { | |
ListItem item = list.elementAt(70); | |
Scrollable.ensureVisible(item.itemKey.currentContext); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final ScrollController scrollController = ScrollController(); | |
@override | |
void initState() { | |
WidgetsBinding.instance.addPostFrameCallback((_) { | |
scrollController.animateTo(60.0 * 70, | |
curve: Curves.linear, duration: Duration(milliseconds: 500)); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListItem { | |
final GlobalKey itemKey = GlobalKey(); | |
final int index; | |
ListItem({ | |
this.index, | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
final int id; | |
final String name; | |
final CarBrand brand; | |
Car({ | |
this.id, | |
this.name, | |
this.brand, | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum CarBrand { | |
Volvo, | |
Mercedes, | |
BMW, | |
Tesla, | |
Ford, | |
VW, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Car myCar = Car( | |
id: 1, | |
name: "THE BUG", | |
brand: CarBrand.VW, | |
); | |
bool isGood(Car car) { | |
return car.brand == CarBrand.Tesla || car.name == "THE BUG"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 1, | |
"name": "THE BUG", | |
"brand": "VW", | |
}, | |
{ | |
"id": 2, | |
"name": "A car", | |
"brand": "BMW", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
final int id; | |
final String name; | |
final CarBrand brand; | |
Car({ | |
this.id, | |
this.name, | |
this.brand, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place fonts/icomoon.ttf in your fonts/ directory and | |
// add the following to your pubspec.yaml | |
// flutter: | |
// fonts: | |
// - family: icomoon | |
// fonts: | |
// - asset: fonts/icomoon.ttf | |
import 'package:flutter/widgets.dart'; | |
class Icomoon { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"quizId": 1, | |
"data": [ | |
{ | |
"questionId": 1, | |
"title": "Best programming language", | |
"body": "", | |
"correctAnswer": "1", | |
"answers": [ | |
{ |
OlderNewer