diff --git a/lib/07/01/main.dart b/lib/07/01/main.dart index 6d242e4..27f540b 100644 --- a/lib/07/01/main.dart +++ b/lib/07/01/main.dart @@ -16,6 +16,7 @@ class MyApp extends StatelessWidget { debugShowCheckedModeBanner: false, theme: ThemeData( appBarTheme: AppBarTheme( + elevation: 0, iconTheme: IconThemeData(color: Colors.black), titleTextStyle: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold) ) diff --git a/lib/07/01/pages/page_a.dart b/lib/07/01/pages/page_a.dart index 3a6b700..940ff84 100644 --- a/lib/07/01/pages/page_a.dart +++ b/lib/07/01/pages/page_a.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:iroute/07/01/pages/page_b.dart'; +import 'page_b.dart'; class PageA extends StatelessWidget { const PageA({super.key}); @@ -10,14 +10,13 @@ class PageA extends StatelessWidget { return Scaffold( backgroundColor: bgColor, - appBar: AppBar(title: Text('A'), - elevation: 0, + appBar: AppBar(title: const Text('A'), backgroundColor: bgColor, ), body: Center( child: ElevatedButton( onPressed: ()=>toPageB(context), - child: Text('Push B'), + child: const Text('Push B'), ), ), ); diff --git a/lib/07/01/pages/page_b.dart b/lib/07/01/pages/page_b.dart index 843d2a2..a132264 100644 --- a/lib/07/01/pages/page_b.dart +++ b/lib/07/01/pages/page_b.dart @@ -11,14 +11,13 @@ class PageB extends StatelessWidget { return Scaffold( backgroundColor: bgColor, - appBar: AppBar(title: Text('B',style: TextStyle(color: Colors.black),), - elevation: 0, + appBar: AppBar(title: const Text('B',), backgroundColor: bgColor, ), body: Center( child: ElevatedButton( onPressed: ()=>toPageC(context), - child: Text('Push C'), + child: const Text('Push C'), ), ), ); diff --git a/lib/07/01/pages/page_c.dart b/lib/07/01/pages/page_c.dart index ff39d99..ac595f0 100644 --- a/lib/07/01/pages/page_c.dart +++ b/lib/07/01/pages/page_c.dart @@ -5,12 +5,16 @@ class PageC extends StatelessWidget { @override Widget build(BuildContext context) { + const Color bgColor = Color(0xffFFE6CD); + return Scaffold( - appBar: AppBar(title: Text('C'),), - body: Center( - child: Text( - 'C' - ), + backgroundColor: bgColor, + appBar: AppBar( + title: const Text('C'), + backgroundColor: bgColor, + ), + body: const Center( + child: Text('到达终点'), ), ); } diff --git a/lib/07/02/main.dart b/lib/07/02/main.dart new file mode 100644 index 0000000..27f540b --- /dev/null +++ b/lib/07/02/main.dart @@ -0,0 +1,27 @@ +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( + elevation: 0, + iconTheme: IconThemeData(color: Colors.black), + titleTextStyle: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold) + ) + ), + home: const PageA(), + ); + } +} diff --git a/lib/07/02/pages/page_a.dart b/lib/07/02/pages/page_a.dart new file mode 100644 index 0000000..49e5c38 --- /dev/null +++ b/lib/07/02/pages/page_a.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import '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: const Text('A'), + backgroundColor: bgColor, + ), + body: Center( + child: ElevatedButton( + onPressed: ()=>toPageB(context), + child: const Text('Push B'), + ), + ), + ); + } + + void toPageB(BuildContext context){ + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_)=> const PageB())); + } +} diff --git a/lib/07/02/pages/page_b.dart b/lib/07/02/pages/page_b.dart new file mode 100644 index 0000000..6149991 --- /dev/null +++ b/lib/07/02/pages/page_b.dart @@ -0,0 +1,29 @@ +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: const Text('B',), + backgroundColor: bgColor, + ), + body: Center( + child: ElevatedButton( + onPressed: ()=>toPageC(context), + child: const Text('Push C'), + ), + ), + ); + } + + void toPageC(BuildContext context){ + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_)=> const PageC())); + } +} \ No newline at end of file diff --git a/lib/07/02/pages/page_c.dart b/lib/07/02/pages/page_c.dart new file mode 100644 index 0000000..ac595f0 --- /dev/null +++ b/lib/07/02/pages/page_c.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class PageC extends StatelessWidget { + const PageC({super.key}); + + @override + Widget build(BuildContext context) { + const Color bgColor = Color(0xffFFE6CD); + + return Scaffold( + backgroundColor: bgColor, + appBar: AppBar( + title: const Text('C'), + backgroundColor: bgColor, + ), + body: const Center( + child: Text('到达终点'), + ), + ); + } +} diff --git a/lib/07/节点介绍.txt b/lib/07/节点介绍.txt new file mode 100644 index 0000000..b50e9a9 --- /dev/null +++ b/lib/07/节点介绍.txt @@ -0,0 +1,4 @@ +01: 分析 push 方法。 + A、B、C 三个界面跳转。 + +02: replace \ No newline at end of file diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index c24583a..47e60d3 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -227,7 +227,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 9f428e2..de32af6 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@