-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
343 additions
and
79 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,79 @@ | ||
import 'package:fix_ms/routes.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const MyApp()); | ||
runApp(const FixMSApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({super.key}); | ||
class FixMSApp extends StatelessWidget { | ||
const FixMSApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'FixMS', | ||
title: 'fixMS', | ||
theme: ThemeData( | ||
primarySwatch: Colors.lightGreen, | ||
primarySwatch: createMaterialColor(const Color(0xFFDA121A)), | ||
primaryColor: const Color(0xFFDA121A), | ||
backgroundColor: const Color(0xFFFCDD09), | ||
scaffoldBackgroundColor: const Color(0xFFFCDD09), | ||
), | ||
home: const MyHomePage(title: 'FixMS - Home'), | ||
initialRoute: Routes.onboarding, | ||
onGenerateRoute: (settings) { | ||
final builder = Routes.getRoutesMap()[settings.name]; | ||
if (builder == null) { | ||
return null; | ||
} // Or some error page? Shouldn't happen anyway - this is basically 404 | ||
return buildRoute(builder(), settings); | ||
}, | ||
); | ||
} | ||
} | ||
|
||
class MyHomePage extends StatefulWidget { | ||
const MyHomePage({super.key, required this.title}); | ||
|
||
final String title; | ||
|
||
@override | ||
State<MyHomePage> createState() => _MyHomePageState(); | ||
PageRouteBuilder buildRoute(Widget target, RouteSettings settings) { | ||
return PageRouteBuilder( | ||
settings: settings, | ||
pageBuilder: ( | ||
BuildContext context, | ||
Animation<double> animation, | ||
Animation<double> secondaryAnimation, | ||
) => | ||
target, | ||
transitionDuration: const Duration(milliseconds: 0), | ||
reverseTransitionDuration: const Duration(milliseconds: 0), | ||
transitionsBuilder: ( | ||
BuildContext context, | ||
Animation<double> animation, | ||
Animation<double> secondaryAnimation, | ||
Widget child, | ||
) { | ||
return SlideTransition( | ||
position: Tween<Offset>( | ||
begin: const Offset(1, 0), | ||
end: Offset.zero, | ||
).animate(animation), | ||
child: child, | ||
); | ||
}, | ||
); | ||
} | ||
} | ||
|
||
class _MyHomePageState extends State<MyHomePage> { | ||
int _counter = 0; | ||
MaterialColor createMaterialColor(Color color) { | ||
List strengths = <double>[.05]; | ||
final swatch = <int, Color>{}; | ||
final int r = color.red, g = color.green, b = color.blue; | ||
|
||
void _incrementCounter() { | ||
setState(() { | ||
_counter++; | ||
}); | ||
for (int i = 1; i < 10; i++) { | ||
strengths.add(0.1 * i); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text(widget.title), | ||
), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
const Text( | ||
'You have pushed the button this many times:', | ||
), | ||
Text( | ||
'$_counter', | ||
style: Theme.of(context).textTheme.headline4, | ||
), | ||
], | ||
), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: _incrementCounter, | ||
tooltip: 'Increment', | ||
child: const Icon(Icons.add), | ||
), // This trailing comma makes auto-formatting nicer for build methods. | ||
for (final strength in strengths) { | ||
final double ds = 0.5 - strength; | ||
swatch[(strength * 1000).round()] = Color.fromRGBO( | ||
r + ((ds < 0 ? r : (255 - r)) * ds).round(), | ||
g + ((ds < 0 ? g : (255 - g)) * ds).round(), | ||
b + ((ds < 0 ? b : (255 - b)) * ds).round(), | ||
1, | ||
); | ||
} | ||
return MaterialColor(color.value, swatch); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:fix_ms/routes.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class HomeScreen extends StatefulWidget { | ||
|
||
const HomeScreen({super.key}); | ||
|
||
@override | ||
State<HomeScreen> createState() => HomeScreenState(); | ||
} | ||
|
||
class HomeScreenState extends State<HomeScreen> { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: SafeArea( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const Text( | ||
'Hier ist mein Zuhause', | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.home); | ||
}, | ||
child: const Text( | ||
'Open Home', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.form); | ||
}, | ||
child: const Text( | ||
'Open Form', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.settings); | ||
}, | ||
child: const Text( | ||
'Open Settings', | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:fix_ms/routes.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class IssueFormScreen extends StatefulWidget { | ||
|
||
const IssueFormScreen({super.key}); | ||
|
||
@override | ||
State<IssueFormScreen> createState() => IssueFormScreenState(); | ||
} | ||
|
||
class IssueFormScreenState extends State<IssueFormScreen> { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const Text( | ||
'Hier ist die Form', | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.home); | ||
}, | ||
child: const Text( | ||
'Open Home', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.form); | ||
}, | ||
child: const Text( | ||
'Open Form', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.settings); | ||
}, | ||
child: const Text( | ||
'Open Settings', | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import 'package:fix_ms/routes.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class OnboardingScreen extends StatelessWidget { | ||
|
||
const OnboardingScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final screenHeight = MediaQuery.of(context).size.height; | ||
return Scaffold( | ||
body: Container( | ||
decoration: const BoxDecoration( | ||
image: DecorationImage( | ||
fit: BoxFit.fill, | ||
image: AssetImage( | ||
'assets/images/onboarding_background.jpg', | ||
), | ||
), | ||
), | ||
child: Column( | ||
mainAxisSize: MainAxisSize.max, | ||
children: [ | ||
SizedBox( | ||
height: screenHeight * 0.1, | ||
), | ||
const Text( | ||
'fixMS', | ||
style: TextStyle( | ||
fontSize: 40, | ||
), | ||
), | ||
SizedBox( | ||
height: screenHeight * 0.2, | ||
), | ||
Container( | ||
color: const Color.fromARGB(180, 255, 255, 255), | ||
child: RichText( | ||
textAlign: TextAlign.center, | ||
text: const TextSpan( | ||
text: 'Willkomen bei ', | ||
style: TextStyle( | ||
fontSize: 20, | ||
color: Colors.black, | ||
), | ||
children: [ | ||
TextSpan(text: 'fixMS', style: TextStyle(fontWeight: FontWeight.bold)), | ||
TextSpan(text: '. Wir möchten Dir helfen, Dein '), | ||
TextSpan(text: 'Münster', style: TextStyle(fontWeight: FontWeight.bold)), | ||
TextSpan(text: ' schöner und funktionaler zu machen. Du hast etwas entdeckt, das '), | ||
TextSpan(text: 'kaputt', style: TextStyle(fontWeight: FontWeight.bold)), | ||
TextSpan(text: ' oder '), | ||
TextSpan(text: 'dreckig', style: TextStyle(fontWeight: FontWeight.bold)), | ||
TextSpan(text: ' ist? Hier kannst Du es '), | ||
TextSpan(text: 'schnell', style: TextStyle(fontWeight: FontWeight.bold)), | ||
TextSpan(text: ' der richtigen Stelle '), | ||
TextSpan(text: 'melden!', style: TextStyle(fontWeight: FontWeight.bold)), | ||
], | ||
), | ||
), | ||
), | ||
Expanded( | ||
child: Align( | ||
alignment: Alignment.bottomCenter, | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 32), | ||
child: ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.home); | ||
}, | ||
child: const Text( | ||
'Los geht\'s!', | ||
), | ||
), | ||
), | ||
const Padding( | ||
padding: EdgeInsets.only(bottom: 8.0), | ||
child: Text( | ||
'Bernhard Kils CC-BY-SA-3.0', | ||
textAlign: TextAlign.end, | ||
style: TextStyle( | ||
fontSize: 10, | ||
color: Colors.grey, | ||
), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:fix_ms/routes.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SettingsScreen extends StatefulWidget { | ||
|
||
const SettingsScreen({super.key}); | ||
|
||
@override | ||
State<SettingsScreen> createState() => SettingsScreenState(); | ||
} | ||
|
||
class SettingsScreenState extends State<SettingsScreen> { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const Text( | ||
'Hier sind die Einstellungen', | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.home); | ||
}, | ||
child: const Text( | ||
'Open Home', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.form); | ||
}, | ||
child: const Text( | ||
'Open Form', | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: () { | ||
Navigator.of(context).pushNamed(Routes.settings); | ||
}, | ||
child: const Text( | ||
'Open Settings', | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.