mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
Update dashboard.dart
This commit is contained in:
@@ -20,126 +20,124 @@ class Dashboard extends ConsumerWidget {
|
|||||||
final settings = ref.watch(settingsProvider);
|
final settings = ref.watch(settingsProvider);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Stack(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Column(
|
||||||
children: <Widget>[
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: kIsMacOS ? 32.0 : 16.0,
|
||||||
|
width: 64,
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
IconButton(
|
||||||
height: kIsMacOS ? 32.0 : 16.0,
|
isSelected: railIdx == 0,
|
||||||
width: 64,
|
onPressed: () {
|
||||||
|
ref.read(navRailIndexStateProvider.notifier).state = 0;
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.auto_awesome_mosaic_outlined),
|
||||||
|
selectedIcon: const Icon(Icons.auto_awesome_mosaic),
|
||||||
),
|
),
|
||||||
Column(
|
Text(
|
||||||
mainAxisSize: MainAxisSize.min,
|
'Requests',
|
||||||
children: [
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
IconButton(
|
|
||||||
isSelected: railIdx == 0,
|
|
||||||
onPressed: () {
|
|
||||||
ref.read(navRailIndexStateProvider.notifier).state = 0;
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.auto_awesome_mosaic_outlined),
|
|
||||||
selectedIcon: const Icon(Icons.auto_awesome_mosaic),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Requests',
|
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
kVSpacer10,
|
|
||||||
IconButton(
|
|
||||||
isSelected: railIdx == 1,
|
|
||||||
onPressed: () {
|
|
||||||
ref.read(navRailIndexStateProvider.notifier).state = 1;
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.laptop_windows_outlined),
|
|
||||||
selectedIcon: const Icon(Icons.laptop_windows),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Variables',
|
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
kVSpacer10,
|
|
||||||
IconButton(
|
|
||||||
isSelected: railIdx == 2,
|
|
||||||
onPressed: () {
|
|
||||||
ref.read(navRailIndexStateProvider.notifier).state = 2;
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.history_outlined),
|
|
||||||
selectedIcon: const Icon(Icons.history_rounded),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'History',
|
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Expanded(
|
kVSpacer10,
|
||||||
child: Column(
|
IconButton(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
isSelected: railIdx == 1,
|
||||||
children: [
|
onPressed: () {
|
||||||
Padding(
|
ref.read(navRailIndexStateProvider.notifier).state = 1;
|
||||||
padding: const EdgeInsets.only(bottom: 16.0),
|
},
|
||||||
child: NavbarButton(
|
icon: const Icon(Icons.laptop_windows_outlined),
|
||||||
railIdx: railIdx,
|
selectedIcon: const Icon(Icons.laptop_windows),
|
||||||
selectedIcon: Icons.help,
|
),
|
||||||
icon: Icons.help_outline,
|
Text(
|
||||||
label: 'About',
|
'Variables',
|
||||||
showLabel: false,
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
isCompact: true,
|
),
|
||||||
onTap: () {
|
kVSpacer10,
|
||||||
showAboutAppDialog(context);
|
IconButton(
|
||||||
},
|
isSelected: railIdx == 2,
|
||||||
),
|
onPressed: () {
|
||||||
),
|
ref.read(navRailIndexStateProvider.notifier).state = 2;
|
||||||
Padding(
|
},
|
||||||
padding: const EdgeInsets.only(bottom: 16.0),
|
icon: const Icon(Icons.history_outlined),
|
||||||
child: NavbarButton(
|
selectedIcon: const Icon(Icons.history_rounded),
|
||||||
railIdx: railIdx,
|
),
|
||||||
buttonIdx: 3,
|
Text(
|
||||||
selectedIcon: Icons.settings,
|
'History',
|
||||||
icon: Icons.settings_outlined,
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
label: 'Settings',
|
|
||||||
showLabel: false,
|
|
||||||
isCompact: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
VerticalDivider(
|
|
||||||
thickness: 1,
|
|
||||||
width: 1,
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: IndexedStack(
|
child: Column(
|
||||||
alignment: AlignmentDirectional.topCenter,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
index: railIdx,
|
children: [
|
||||||
children: const [
|
Padding(
|
||||||
HomePage(),
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
EnvironmentPage(),
|
child: NavbarButton(
|
||||||
HistoryPage(),
|
railIdx: railIdx,
|
||||||
SettingsPage(),
|
selectedIcon: Icons.help,
|
||||||
|
icon: Icons.help_outline,
|
||||||
|
label: 'About',
|
||||||
|
showLabel: false,
|
||||||
|
isCompact: true,
|
||||||
|
onTap: () {
|
||||||
|
showAboutAppDialog(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: NavbarButton(
|
||||||
|
railIdx: railIdx,
|
||||||
|
buttonIdx: 3,
|
||||||
|
selectedIcon: Icons.settings,
|
||||||
|
icon: Icons.settings_outlined,
|
||||||
|
label: 'Settings',
|
||||||
|
showLabel: false,
|
||||||
|
isCompact: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
VerticalDivider(
|
||||||
// DashBot Overlay
|
thickness: 1,
|
||||||
if (isDashBotVisible)
|
width: 1,
|
||||||
Positioned(
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
bottom: 20,
|
),
|
||||||
right: 20,
|
Expanded(
|
||||||
child: const DashBotOverlay(),
|
child: IndexedStack(
|
||||||
|
alignment: AlignmentDirectional.topCenter,
|
||||||
|
index: railIdx,
|
||||||
|
children: const [
|
||||||
|
HomePage(),
|
||||||
|
EnvironmentPage(),
|
||||||
|
HistoryPage(),
|
||||||
|
SettingsPage(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: settings.isDashBotEnabled
|
floatingActionButton: settings.isDashBotEnabled
|
||||||
? const DashBotFAB()
|
? FloatingActionButton(
|
||||||
|
onPressed: () => showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) => const Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: DashBotWidget(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Icon(Icons.help_outline),
|
||||||
|
)
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user