mirror of
https://github.com/foss42/apidash.git
synced 2025-12-04 03:46:57 +08:00
feat(mobile): added MobileDashboard widget with Drawer config
Created new dynamic MobileDashboard widget with basic home, requests and settigns navigations within the side drawer
This commit is contained in:
83
lib/widgets/mobile_dashboard.dart
Normal file
83
lib/widgets/mobile_dashboard.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:apidash/screens/home_page/collection_pane.dart';
|
||||
import 'package:apidash/screens/intro_page.dart';
|
||||
import 'package:apidash/screens/settings_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class MobileDashboard extends ConsumerStatefulWidget {
|
||||
const MobileDashboard(
|
||||
{required this.scaffoldBody, required this.title, super.key});
|
||||
|
||||
final Widget scaffoldBody;
|
||||
final String title;
|
||||
|
||||
@override
|
||||
ConsumerState<MobileDashboard> createState() => _MobileDashboardState();
|
||||
}
|
||||
|
||||
class _MobileDashboardState extends ConsumerState<MobileDashboard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Home'),
|
||||
leading: const Icon(Icons.home_outlined),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const MobileDashboard(
|
||||
title: 'Home',
|
||||
scaffoldBody: IntroPage(),
|
||||
),
|
||||
),
|
||||
(Route<dynamic> route) => false);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Requests'),
|
||||
leading: const Icon(Icons.auto_awesome_mosaic_outlined),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const MobileDashboard(
|
||||
title: 'Requests',
|
||||
scaffoldBody: CollectionPane(),
|
||||
),
|
||||
),
|
||||
(Route<dynamic> route) => false);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Settings'),
|
||||
leading: const Icon(Icons.settings_outlined),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const MobileDashboard(
|
||||
title: 'Settings',
|
||||
scaffoldBody: SettingsPage(),
|
||||
),
|
||||
),
|
||||
(Route<dynamic> route) => false);
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: widget.scaffoldBody,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user