This file contains 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 BadAssociationWidget extends StatelessWidget { | |
const BadAssociationWidget(); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
margin: const EdgeInsets.symmetric(horizontal: 16), | |
child: Text('Hello with Margin'), | |
); | |
} |
This file contains 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 AwesomeWidget extends StatelessWidget { | |
const AwesomeWidget({ | |
super.key, | |
}); | |
@override | |
Widget build(BuildContext, context) { | |
void showUserScreen() { | |
// show user screen | |
} |
This file contains 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 Awesome { | |
const Awesome.positional(this.value); | |
const Awesome.named({required this.value}); | |
final int value; | |
} | |
/// Instanciation | |
final positional = Awesome.positional(1); |
This file contains 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 SomeWidget extends ConsumerWidget { | |
const SomeWidget({ | |
super.key, | |
}); | |
@override | |
Widget build(BuildContext context, WidgetRef ref) { | |
final musicId = ref.watch(musicIdProvider); | |
final volume = ref.watch(volumeProvider); | |
This file contains 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 SomeWidget extends ConsumerWidget { | |
const SomeWidget({ | |
super.key, | |
}); | |
Future<void> _playMusic({ | |
required BuildContext context, | |
required WidgetRef ref, | |
required int musicId, | |
required int volume, |
This file contains 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 MyGreatestWidget extends StatelessWidget { | |
const MyGreatestWidget({ | |
Key? key, | |
required this.onPressed, | |
}) : super(key: key); | |
final ValueCallback<String> onPressed; | |
@override | |
Widget build(BuildContext context) { |
This file contains 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 SomeBuilder extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Builder( | |
builder: (innerContext) { | |
return NewIconButton(); | |
}, | |
); | |
} | |
} |
This file contains 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 SomeBuilder extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Builder( | |
builder: (innerContext) { | |
return IconButton( | |
onPressed: () { | |
final theme = Theme.of(context); | |
..., | |
} |
This file contains 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 SomeBigWidgetState extends State<SomeBigWidget> { | |
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
children: [ | |
_buildSomeWidget1(), | |
_buildSomeWidget2(), | |
_buildSomeWidget3(), | |
_buildLikeButton(), | |
], |
This file contains 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
// some_screen.dart | |
class SomeScreen extends StatelessWidget { | |
static GoRoute route({ | |
List<GoRoute> routes = const <GoRoute>[], | |
}) { | |
return GoRoute( | |
path: routeName, | |
name: routeName, | |
builder: (_, __) => const SomeScreen(), | |
routes: routes, |