Switch between Pages (Navbar) 17.11.2022 16:31
- Ortner Elias
This commit is contained in:
+128
-5
@@ -11,12 +11,8 @@ class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
return const MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.green,
|
||||
scaffoldBackgroundColor: const Color(0xFFFFFFFF)
|
||||
),
|
||||
home: const MyHomePage(title: 'Bürger Forum Oggau'),
|
||||
);
|
||||
}
|
||||
@@ -31,6 +27,24 @@ class MyHomePage extends StatefulWidget {
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class ProfilePage extends StatefulWidget {
|
||||
const ProfilePage({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<ProfilePage> createState() => _ProfilePageState();
|
||||
}
|
||||
|
||||
class MangelPage extends StatefulWidget {
|
||||
const MangelPage({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MangelPage> createState() => _MangelPageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
@@ -40,6 +54,22 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
});
|
||||
}
|
||||
|
||||
void _pushMangel(){
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const MangelPage(title: 'Mängel'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _pushProfile(){
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ProfilePage(title: 'Profil'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -74,6 +104,53 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
child: IconTheme(
|
||||
data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
tooltip: 'News',
|
||||
icon: const Icon(Icons.newspaper),
|
||||
onPressed: () {},
|
||||
),
|
||||
//if (centerLocations.contains(fabLocation)) const Spacer(),
|
||||
IconButton(
|
||||
tooltip: 'Mängel',
|
||||
icon: const Icon(Icons.warning),
|
||||
onPressed: () => {_pushMangel()},
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Profil',
|
||||
icon: const Icon(Icons.person),
|
||||
onPressed: () => {_pushProfile()},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ProfilePageState extends State<ProfilePage> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
|
||||
child: Column(
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
color: const Color(0xFF1601FD),
|
||||
child: IconTheme(
|
||||
data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
tooltip: 'News',
|
||||
@@ -89,7 +166,53 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
tooltip: 'Profil',
|
||||
icon: const Icon(Icons.person),
|
||||
onPressed: () => {},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MangelPageState extends State<MangelPage> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
|
||||
child: Column(
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
color: const Color(0xFF1601FD),
|
||||
child: IconTheme(
|
||||
data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
tooltip: 'News',
|
||||
icon: const Icon(Icons.newspaper),
|
||||
onPressed: () {},
|
||||
),
|
||||
//if (centerLocations.contains(fabLocation)) const Spacer(),
|
||||
IconButton(
|
||||
tooltip: 'Mängel',
|
||||
icon: const Icon(Icons.warning),
|
||||
onPressed: () {},
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Profil',
|
||||
icon: const Icon(Icons.person),
|
||||
onPressed: () => {},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user