mirror of https://github.com/flutter/samples.git
parent
41f68a6f56
commit
5c957adc5c
@ -0,0 +1,11 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"dart": {
|
||||
"command": "dart",
|
||||
"args": [
|
||||
"mcp-server"
|
||||
]
|
||||
}
|
||||
},
|
||||
"contextFileName": "/.prompts/llm.md"
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class CheckboxPage extends StatefulWidget {
|
||||
const CheckboxPage({super.key});
|
||||
|
||||
@override
|
||||
State<CheckboxPage> createState() => _CheckboxPageState();
|
||||
}
|
||||
|
||||
class _CheckboxPageState extends State<CheckboxPage> {
|
||||
bool _value = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
middle: Text('Checkbox'),
|
||||
),
|
||||
child: Center(
|
||||
child: CupertinoCheckbox(
|
||||
value: _value,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
_value = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class RadioPage extends StatefulWidget {
|
||||
const RadioPage({super.key});
|
||||
|
||||
@override
|
||||
State<RadioPage> createState() => _RadioPageState();
|
||||
}
|
||||
|
||||
class _RadioPageState extends State<RadioPage> {
|
||||
int _selectedValue = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(middle: Text('Radio')),
|
||||
child: Center(
|
||||
child: RadioGroup(
|
||||
groupValue: _selectedValue,
|
||||
onChanged: (int? value) {
|
||||
setState(() {
|
||||
_selectedValue = value!;
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
CupertinoListTile(
|
||||
title: const Text('Option 1'),
|
||||
leading: CupertinoRadio<int>(value: 0),
|
||||
),
|
||||
CupertinoListTile(
|
||||
title: const Text('Option 2'),
|
||||
leading: CupertinoRadio<int>(value: 1),
|
||||
),
|
||||
CupertinoListTile(
|
||||
title: const Text('Option 3'),
|
||||
leading: CupertinoRadio<int>(value: 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class SheetPage extends StatelessWidget {
|
||||
const SheetPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(middle: Text('Sheet')),
|
||||
child: Center(
|
||||
child: CupertinoButton.filled(
|
||||
child: const Text('Show Sheet'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoSheetRoute<void>(
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: const Text('Sheet'),
|
||||
trailing: GestureDetector(
|
||||
child: const Icon(CupertinoIcons.xmark),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text('This is a sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue