-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
136 additions
and
92 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Form_DropdownMenu.dart
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
main() { | ||
runApp(const MaterialApp(home: Scaffold(body: Form_DropdownMenu()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Form_DropdownMenu extends StatelessWidget { | ||
const Form_DropdownMenu({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [ | ||
const Text("enableFilter: true "), | ||
DropdownMenu<TargetPlatform>( | ||
label: const Text('platform'), | ||
enableFilter: true, | ||
onSelected: (value) {}, | ||
dropdownMenuEntries: TargetPlatform.values.map((e) { | ||
return DropdownMenuEntry<TargetPlatform>(value: e, label: e.name); | ||
}).toList(), | ||
) | ||
]), | ||
Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [ | ||
const Text("enableFilter: false"), | ||
DropdownMenu<TargetPlatform>( | ||
label: const Text('platform'), | ||
enableFilter: false, | ||
onSelected: (value) {}, | ||
dropdownMenuEntries: TargetPlatform.values.map((e) { | ||
return DropdownMenuEntry<TargetPlatform>(value: e, label: e.name); | ||
}).toList(), | ||
), | ||
]), | ||
], | ||
); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Form_Radio.dart
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:you_flutter/state.dart'; | ||
|
||
main() { | ||
runApp(MaterialApp(home: Scaffold(body: Form_Radio()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Form_Radio extends StatelessWidget { | ||
Form_Radio({super.key}); | ||
|
||
final List<TargetPlatform> targets = List.of([TargetPlatform.linux, TargetPlatform.windows, TargetPlatform.macOS]); | ||
final Value<TargetPlatform?> radioListTile = (null as TargetPlatform?).signal(); | ||
final Value<TargetPlatform?> radio = (null as TargetPlatform?).signal(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Watch( | ||
builder: (context) { | ||
return Column( | ||
children: <Widget>[ | ||
Wrap( | ||
children: [ | ||
const Text("RadioListTile:"), | ||
for (var t in targets) | ||
RadioListTile<TargetPlatform>( | ||
title: Text(t.name), | ||
value: t, | ||
groupValue: radioListTile.value, | ||
toggleable: true, | ||
onChanged: (value) => radioListTile.value = value, | ||
), | ||
const Text("Radio:"), | ||
for (var t in targets) | ||
ListTile( | ||
title: Text(t.name), | ||
leading: Radio<TargetPlatform>( | ||
value: t, | ||
groupValue: radio.value, | ||
onChanged: (value) => radio.value = value, | ||
), | ||
), | ||
], | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Form_showTimePicker.dart
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:you_flutter/state.dart'; | ||
|
||
main() { | ||
runApp(MaterialApp(home: Scaffold(body: Form_showTimePicker()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Form_showTimePicker extends StatelessWidget { | ||
Form_showTimePicker({super.key}); | ||
|
||
final Value<TimeOfDay?> time = (null as TimeOfDay?).signal(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Watch( | ||
builder: (context) { | ||
return Column( | ||
children: <Widget>[ | ||
Text("date: ${time.value}"), | ||
TextButton.icon( | ||
onPressed: () async { | ||
TimeOfDay? selected = await showTimePicker( | ||
context: context, | ||
initialTime: TimeOfDay.now(), | ||
); | ||
time.value = selected; | ||
}, | ||
icon: const Icon(Icons.timer_outlined), | ||
label: const Text('showTimePicker dialog'), | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
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