Navigation Bar

welcome
Bogdan Kotikov 2023-04-23 13:08:04 +02:00
parent 345a9e0d4e
commit ff74c58163
7 changed files with 350 additions and 13 deletions

View File

@ -51,7 +51,7 @@
}, },
{ {
"name": "flutter", "name": "flutter",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter", "rootUri": "file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
@ -63,7 +63,7 @@
}, },
{ {
"name": "flutter_test", "name": "flutter_test",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test", "rootUri": "file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter_test",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.17" "languageVersion": "2.17"
}, },
@ -105,7 +105,7 @@
}, },
{ {
"name": "sky_engine", "name": "sky_engine",
"rootUri": "file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine", "rootUri": "file:///Users/bogdan/fvm/versions/3.7.9/bin/cache/pkg/sky_engine",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "languageVersion": "2.12"
}, },
@ -158,7 +158,7 @@
"languageVersion": "2.19" "languageVersion": "2.19"
} }
], ],
"generated": "2023-04-17T20:45:45.108623Z", "generated": "2023-04-19T19:12:52.160361Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.19.6" "generatorVersion": "2.19.6"
} }

View File

@ -88,18 +88,18 @@ file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/
file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ file:///Users/bogdan/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/
ernaehrung ernaehrung
2.19 2.19
file:///Users/bogdan/IdeaProjects/erna%CC%88hrung/ file:///Users/bogdan/IdeaProjects/ernaehrung/
file:///Users/bogdan/IdeaProjects/erna%CC%88hrung/lib/ file:///Users/bogdan/IdeaProjects/ernaehrung/lib/
sky_engine sky_engine
2.12 2.12
file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/ file:///Users/bogdan/fvm/versions/3.7.9/bin/cache/pkg/sky_engine/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/bin/cache/pkg/sky_engine/lib/ file:///Users/bogdan/fvm/versions/3.7.9/bin/cache/pkg/sky_engine/lib/
flutter flutter
2.17 2.17
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/ file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter/lib/ file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter/lib/
flutter_test flutter_test
2.17 2.17
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/ file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter_test/
file:///usr/local/Caskroom/flutter/3.7.7/flutter/packages/flutter_test/lib/ file:///Users/bogdan/fvm/versions/3.7.9/packages/flutter_test/lib/
2 2

View File

@ -1,3 +1,4 @@
import 'package:ernaehrung/pages/nav_pages/main_page.dart';
import 'package:ernaehrung/views/navigation/navigationScreen.dart'; import 'package:ernaehrung/views/navigation/navigationScreen.dart';
import 'package:ernaehrung/views/welcome/welcomeScreen.dart'; import 'package:ernaehrung/views/welcome/welcomeScreen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -16,7 +17,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: const WelcomeScreen(), home: const MainPage(),
routes: { routes: {
'/navigation': (context) => const NavigationScreen(), '/navigation': (context) => const NavigationScreen(),
}, },

View File

@ -0,0 +1,60 @@
import 'package:ernaehrung/pages/nav_pages/progress_page.dart';
import 'package:ernaehrung/pages/nav_pages/today_page.dart';
import 'package:flutter/material.dart';
import 'meal_plan_page.dart';
class MainPage extends StatefulWidget {
const MainPage({Key? key}) : super(key: key);
@override
_MainPageState createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
List pages = [
const TodayPage(title: 'Today',),
const MealPlanPage(title: 'Meal Plan'),
const ProgressPage(title: 'Progress',)
];
int currentIndex = 0;
void onTap(int index){
setState(() {
currentIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Title'),
),
body: pages[currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: currentIndex,
selectedItemColor: Colors.black54,
unselectedItemColor: Colors.grey.withOpacity(0.5),
showSelectedLabels: false,
showUnselectedLabels: false,
elevation: 0,
onTap: onTap,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.today),
label: 'Today'
),
BottomNavigationBarItem(
icon: Icon(Icons.area_chart),
label: 'Progress'
),
BottomNavigationBarItem(
icon: Icon(Icons.apple),
label: 'Meal Plan'
),
],
),
);
}
}

View File

@ -0,0 +1,18 @@
import 'package:flutter/cupertino.dart';
class MealPlanPage extends StatelessWidget {
final String title;
const MealPlanPage({Key? key, required this.title}) : super(key: key);
String get getTitle => title;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return getTitle;
}
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

View File

@ -0,0 +1,20 @@
import 'package:flutter/cupertino.dart';
class ProgressPage extends StatelessWidget {
final String title;
const ProgressPage({Key? key, required this.title}) : super(key: key);
String get getTitle => title;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return getTitle;
}
@override
Widget build(BuildContext context) {
return Container(
);
}
}

View File

@ -0,0 +1,238 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class TodayPage extends StatefulWidget {
final String title;
const TodayPage({Key? key, required this.title}) : super(key: key);
@override
State<TodayPage> createState() => _TodayPageState();
}
class _TodayPageState extends State<TodayPage> {
String calories = "123 Cals";
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5), // if you need this
side: BorderSide(
color: Colors.grey.withOpacity(.2),
width: 1,
),
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Text('Frühstück'), Text('Cals 123')],
),
SizedBox(
height: 200,
child: Stack(
children: <Widget>[
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
Padding(
padding: EdgeInsets.fromLTRB(8.0, 13.0, 8.0, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 50.0,
width: 60.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Image.network(
'https://onlinejpgtools.com/images/examples-onlinejpgtools/coffee-resized.jpg',
fit: BoxFit.cover,
),
),
),
SizedBox(
width: 8,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Cafe Coffee Day',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
Text(
'Alpha 1, Greater Noida',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
),
Divider(
color: Colors.black,
thickness: .2,
indent: 8,
endIndent: 8,
),
Padding(
padding: EdgeInsets.fromLTRB(8.0, 13.0, 8.0, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 50.0,
width: 60.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Image.network(
'https://onlinejpgtools.com/images/examples-onlinejpgtools/coffee-resized.jpg',
fit: BoxFit.cover,
),
),
),
SizedBox(
width: 8,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Cafe Coffee Day',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
Text(
'Alpha 1, Greater Noida',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
),
Divider(
color: Colors.black,
thickness: .2,
indent: 8,
endIndent: 8,
),
Padding(
padding: EdgeInsets.fromLTRB(8.0, 13.0, 8.0, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 50.0,
width: 60.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Image.network(
'https://onlinejpgtools.com/images/examples-onlinejpgtools/coffee-resized.jpg',
fit: BoxFit.cover,
),
),
),
SizedBox(
width: 8,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Cafe Coffee Day',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
Text(
'Alpha 1, Greater Noida',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
),
Divider(
color: Colors.black,
thickness: .2,
indent: 8,
endIndent: 8,
),
Padding(
padding: EdgeInsets.fromLTRB(8.0, 13.0, 8.0, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 50.0,
width: 60.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Image.network(
'https://onlinejpgtools.com/images/examples-onlinejpgtools/coffee-resized.jpg',
fit: BoxFit.cover,
),
),
),
SizedBox(
width: 8,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Cafe Coffee Day',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
Text(
'Alpha 1, Greater Noida',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
),
Divider(
color: Colors.black,
thickness: .2,
indent: 8,
endIndent: 8,
),
],
),
),
],
),
),
TextButton(onPressed: (){}, child: Text("Test"),
style: ButtonStyle(),)
]
),
),
],
)));
}
}