add about page

This commit is contained in:
2024-10-20 12:12:32 +05:30
parent 95e70e2572
commit 9125041f18
4 changed files with 63 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:iiitb_menu/models/globalModel.dart'; import 'package:iiitb_menu/models/globalModel.dart';
import 'package:iiitb_menu/views/homePage.dart'; import 'package:iiitb_menu/views/homePage.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import "package:iiitb_menu/views/about.dart";
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@@ -20,8 +21,13 @@ class MainApp extends StatelessWidget {
builder: (BuildContext context, child) { builder: (BuildContext context, child) {
return MaterialApp( return MaterialApp(
title: "IIITB Menu", title: "IIITB Menu",
home: const HomePage(), routes: {
theme: ThemeData(useMaterial3: false), "/": (context) => HomePage(),
"/info": (context) => AboutPage(),
},
initialRoute: "/",
// home: const HomePage(),
theme: ThemeData(useMaterial3: true),
); );
}, },
); );

21
lib/views/about.dart Normal file
View File

@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
class AboutPage extends StatelessWidget {
const AboutPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("About Page")),
body: const Column(
children: [
Image(image: AssetImage("assets/plate.png")),
Text(
"IIIT Bangalore Unofficial Mess Menu",
style: TextStyle(fontSize: 50),
)
],
),
);
}
}

View File

@@ -25,13 +25,40 @@ class HomePage extends StatelessWidget {
return Consumer<GlobalModel>( return Consumer<GlobalModel>(
builder: (BuildContext context, GlobalModel data, Widget? child) { builder: (BuildContext context, GlobalModel data, Widget? child) {
return Scaffold( return Scaffold(
drawer: Drawer(
child: ListView(
children: [
ListTile(
leading: Icon(Icons.menu),
title: Text("Menu"),
onTap: () {
Navigator.pop(context);
}),
ListTile(
leading: Icon(Icons.star),
title: Text("Specials"),
),
Divider(),
ListTile(
leading: Icon(Icons.settings),
title: Text("Settings"),
),
ListTile(
leading: Icon(Icons.info),
title: Text("About App"),
onTap: () {
Navigator.pushNamed(context, "/info");
}),
],
),
),
appBar: AppBar( appBar: AppBar(
title: Text("Daily ${data.menuTime} Menu"), title: Text("Daily ${data.menuTime} Menu"),
bottom: TabBar( bottom: TabBar(
controller: cont, controller: cont,
splashFactory: NoSplash.splashFactory, // splashFactory: InkSplash.splashFactory,
indicator: const UnderlineTabIndicator( // indicator: const UnderlineTabIndicator(
insets: EdgeInsets.fromLTRB(10, 3, 10, 3)), // insets: EdgeInsets.fromLTRB(10, 3, 10, 3)),
onTap: (int index) { onTap: (int index) {
data.setMenuTime(index); data.setMenuTime(index);
}, },

View File

@@ -2,7 +2,7 @@ name: iiitb_menu
description: IIITB Bi-Weekly Menu description: IIITB Bi-Weekly Menu
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application. # The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43 # A version number is three numbers separated by dots, like 1.2.43
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: '>=3.1.0 <4.0.0' sdk: ">=3.1.0 <4.0.0"
# Dependencies specify other packages that your package needs in order to work. # Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions # To automatically upgrade your package dependencies to the latest versions
@@ -31,10 +31,9 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 # cupertino_icons: ^1.0.2
provider: ^6.0.5 provider: ^6.0.5
crypto: ^3.0.3 crypto: ^3.0.3
intl: ^0.18.1 intl: ^0.18.1
@@ -61,7 +60,6 @@ dev_dependencies:
# The following section is specific to Flutter packages. # The following section is specific to Flutter packages.
flutter: flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.