build method
- @override
- BuildContext context,
- SettingsBuilder model
override
Builds the UI according to the state in model.
Implementation
@override
Widget build(BuildContext context, SettingsBuilder model) => AlertDialog(
title: const Text("Settings"),
content: SizedBox(
width: 700,
height: 500,
child: DefaultTabController(
length: 7,
child: Column(
children: [
const TabBar(
isScrollable: true,
tabAlignment: TabAlignment.start,
tabs: [
Tab(icon: Icon(Icons.wifi), text: "Network"),
Tab(
icon: Icon(Icons.settings_input_antenna),
text: "Base Station",
),
Tab(icon: Icon(Icons.precision_manufacturing), text: "Arm"),
Tab(icon: Icon(Icons.science), text: "Science"),
Tab(icon: Icon(Icons.dashboard), text: "Dashboard"),
Tab(icon: Icon(Icons.celebration), text: "Easter Eggs"),
Tab(icon: Icon(Icons.more_horiz), text: "Misc"),
],
),
Expanded(
child: TabBarView(
children: [
_network(context, model),
_baseStation(model),
_arm(model),
_science(model),
_dashboard(context, model),
_easterEggs(model),
_misc(context),
],
),
),
],
),
),
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text("Cancel"),
),
ElevatedButton.icon(
onPressed: !model.isValid
? null
: () async {
await model.save();
if (context.mounted) Navigator.of(context).pop();
},
label: const Text("Save"),
icon: model.isLoading
? const SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(),
)
: const Icon(Icons.save),
),
],
);