mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 20:04:55 +00:00
Implemented Navigation
This commit is contained in:
15
lib/features/home/view/default_app_bar.dart
Normal file
15
lib/features/home/view/default_app_bar.dart
Normal file
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const DefaultAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
title: const Text('Syncrow'),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(50);
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:syncrow_app/features/home/provider/provider.dart';
|
||||
import 'package:syncrow_app/features/home/view/default_app_bar.dart';
|
||||
import 'package:syncrow_app/features/home/view/home_view_body.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_nav_bar.dart';
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
const HomeView({super.key});
|
||||
@ -8,46 +11,17 @@ class HomeView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (BuildContext context) => SceneProvider(),
|
||||
builder: (context, child) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Syncrow'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('Home'),
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.home_outlined,
|
||||
color: Colors.grey,
|
||||
),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.view_in_ar,
|
||||
color: Colors.grey,
|
||||
),
|
||||
label: 'Scene',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.smart_toy_outlined,
|
||||
color: Colors.grey,
|
||||
),
|
||||
label: 'Smart',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.account_circle,
|
||||
color: Colors.grey,
|
||||
),
|
||||
label: 'Account',
|
||||
),
|
||||
],
|
||||
),
|
||||
create: (BuildContext context) => HomeProvider(),
|
||||
builder: (context, child) => Consumer<HomeProvider>(
|
||||
builder: (context, provider, child) {
|
||||
return Scaffold(
|
||||
appBar: const DefaultAppBar(),
|
||||
body: provider.pageIndex == 0
|
||||
? const HomeViewBody()
|
||||
: provider.currentPage,
|
||||
bottomNavigationBar: const DefaultNavBar(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
14
lib/features/home/view/home_view_body.dart
Normal file
14
lib/features/home/view/home_view_body.dart
Normal file
@ -0,0 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeViewBody extends StatelessWidget {
|
||||
const HomeViewBody({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(
|
||||
child: Text('Home'),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user