import 'package:flutter/material.dart'; import 'package:flutter_app/pages/SplashScreen.dart'; import 'right_back_demo.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.green, //定义主题风格 primarySwatch ), home: RightBackDemo(), ); } }
import 'package:flutter/cupertino.dart'; import 'MyHomePage.dart'; class RightBackDemo extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( child: Center( child: Container( height: 100.0, 100.0, color: CupertinoColors.activeBlue, child: CupertinoButton( child: Icon(CupertinoIcons.add), onPressed: (){ Navigator.of(context).push( CupertinoPageRoute(builder: (BuildContext context){ return MyHomePage(); }) ); }, ), ), ), ); } }
即可