New pages added
This commit is contained in:
parent
151cb9e6db
commit
16036ef56e
|
|
@ -12,32 +12,54 @@ class MyApp extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
//title: 'Flutter Formular',
|
||||
theme: ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
||||
// the application has a purple toolbar. Then, without quitting the app,
|
||||
// try changing the seedColor in the colorScheme below to Colors.green
|
||||
// and then invoke "hot reload" (save your changes or press the "hot
|
||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
||||
// the command line to start the app).
|
||||
//
|
||||
// Notice that the counter didn't reset back to zero; the application
|
||||
// state is not lost during the reload. To reset the state, use hot
|
||||
// restart instead.
|
||||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
primaryColor: Colors.lightBlue,
|
||||
),
|
||||
home: const MyFormPage(title: 'Flutter Formular'),
|
||||
);
|
||||
//title: 'Flutter Formular',
|
||||
theme: ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
||||
// the application has a purple toolbar. Then, without quitting the app,
|
||||
// try changing the seedColor in the colorScheme below to Colors.green
|
||||
// and then invoke "hot reload" (save your changes or press the "hot
|
||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
||||
// the command line to start the app).
|
||||
//
|
||||
// Notice that the counter didn't reset back to zero; the application
|
||||
// state is not lost during the reload. To reset the state, use hot
|
||||
// restart instead.
|
||||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
primaryColor: Colors.lightBlue,
|
||||
),
|
||||
home: const MyFormPage(title: 'Flutter Formular'),
|
||||
initialRoute: null,
|
||||
routes: <String, WidgetBuilder>{
|
||||
UIData.homeRoute: (BuildContext context) =>
|
||||
MyFormPage(title: 'SecondPage'), //title=AbsorbPointer()'Start'),
|
||||
UIData.citiesRoute: (BuildContext context) => TypePage(title: 'Type'),
|
||||
UIData.twitter: (BuildContext context) =>
|
||||
CategoriePage(), //title='Kategorie'),
|
||||
//UIData.teamRoute: (BuildContext context) =>TeamsPage(),
|
||||
//UIData.planRoute: (BuildContext context) =>PlanPage(),
|
||||
//UIData.quizRoute: (BuildContext context) =>QuizPage(),
|
||||
//UIData.impressionRoute: (BuildContext context) =>ImpressionPage(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class UIData {
|
||||
//routes
|
||||
static const String homeRoute = "/home";
|
||||
static const String teamRoute = "/teams";
|
||||
static const String planRoute = "/plan";
|
||||
static const String citiesRoute = "/cities";
|
||||
static const String twitter = "/twitter";
|
||||
static const String quizRoute = "/quiz";
|
||||
static const String impressionRoute = "/impression";
|
||||
}
|
||||
|
||||
class MyFormPage extends StatefulWidget {
|
||||
const MyFormPage({Key key = const Key('defaultKey'), required this.title})
|
||||
: super(key: key);
|
||||
|
|
@ -141,8 +163,12 @@ class _MyFormPageState extends State<MyFormPage> {
|
|||
} else {
|
||||
print("Formular ist nicht gültig");
|
||||
}
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return TypePage(title: 'SecondPage');
|
||||
}));
|
||||
},
|
||||
child: const Text('Speichern'),
|
||||
child: const Text('Next'),
|
||||
)
|
||||
],
|
||||
)
|
||||
|
|
@ -161,3 +187,155 @@ class _MyFormPageState extends State<MyFormPage> {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/*class TypePage extends StatelessWidget {
|
||||
const TypePage({Key? key, required this.title}) : super(key: key);
|
||||
final String title;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Type"),
|
||||
),
|
||||
body: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Go Back'),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text('Go to About Page'),
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return CategoriePage();
|
||||
}));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}*/
|
||||
class TypePage extends StatelessWidget {
|
||||
TypePage({Key? key, required this.title}) : super(key: key);
|
||||
final String title;
|
||||
final List<Map> myProducts =
|
||||
List.generate(100000, (index) => {"id": index, "name": "Product $index"})
|
||||
.toList();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Type"),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
// implement GridView.builder
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 200,
|
||||
childAspectRatio: 3 / 2,
|
||||
crossAxisSpacing: 20,
|
||||
mainAxisSpacing: 20),
|
||||
itemCount: myProducts.length,
|
||||
itemBuilder: (BuildContext ctx, index) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(myProducts[index]["name"]),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CategoriePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Kategorie"),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('Button 1'),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Lorem ipsum dolor sit amet',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('Button 1'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('Button 2'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Go Back'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('Button 1'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('Button 2'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Go Back'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue