initial
This commit is contained in:
commit
363f113121
145 files changed
+7746
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'devices_screen.dart';
|
||||
import 'timbang_screen.dart';
|
||||
|
||||
/// Root scaffold with bottom nav: Devices and Timbang (scale display).
|
||||
class MainShell extends StatefulWidget {
|
||||
const MainShell({super.key});
|
||||
|
||||
@override
|
||||
State<MainShell> createState() => _MainShellState();
|
||||
}
|
||||
|
||||
class _MainShellState extends State<MainShell> {
|
||||
int _index = 0;
|
||||
|
||||
static const _tabs = [
|
||||
(label: 'Devices', icon: Icons.list_alt),
|
||||
(label: 'Timbang', icon: Icons.monitor_weight),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
index: _index,
|
||||
children: const [
|
||||
DevicesScreen(),
|
||||
TimbangScreen(),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
currentIndex: _index,
|
||||
onTap: (i) => setState(() => _index = i),
|
||||
items: _tabs
|
||||
.map((t) => BottomNavigationBarItem(
|
||||
icon: Icon(t.icon),
|
||||
label: t.label,
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user