This commit is contained in:
toly
2023-08-31 07:53:30 +08:00
parent 207bf4f832
commit fcaabb18dd
30 changed files with 794 additions and 30 deletions

26
lib/07/01/main.dart Normal file
View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'pages/page_a.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
appBarTheme: AppBarTheme(
iconTheme: IconThemeData(color: Colors.black),
titleTextStyle: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold)
)
),
home: const PageA(),
);
}
}

View File

@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:iroute/07/01/pages/page_b.dart';
class PageA extends StatelessWidget {
const PageA({super.key});
@override
Widget build(BuildContext context) {
const Color bgColor = Color(0xffCCFFFF);
return Scaffold(
backgroundColor: bgColor,
appBar: AppBar(title: Text('A'),
elevation: 0,
backgroundColor: bgColor,
),
body: Center(
child: ElevatedButton(
onPressed: ()=>toPageB(context),
child: Text('Push B'),
),
),
);
}
void toPageB(BuildContext context){
Navigator.of(context).push(MaterialPageRoute(builder: (_)=> const PageB()));
}
}

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'page_c.dart';
class PageB extends StatelessWidget {
const PageB({super.key});
@override
Widget build(BuildContext context) {
const Color bgColor = Color(0xffCCE5FF);
return Scaffold(
backgroundColor: bgColor,
appBar: AppBar(title: Text('B',style: TextStyle(color: Colors.black),),
elevation: 0,
backgroundColor: bgColor,
),
body: Center(
child: ElevatedButton(
onPressed: ()=>toPageC(context),
child: Text('Push C'),
),
),
);
}
void toPageC(BuildContext context){
Navigator.of(context).push(MaterialPageRoute(builder: (_)=> const PageC()));
}
}

View File

@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
class PageC extends StatelessWidget {
const PageC({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('C'),),
body: Center(
child: Text(
'C'
),
),
);
}
}