flutter 右滑返回上一页

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,
          width:100.0,
          color: CupertinoColors.activeBlue,
          child: CupertinoButton(
            child: Icon(CupertinoIcons.add),
            onPressed: (){
              Navigator.of(context).push(
                  CupertinoPageRoute(builder: (BuildContext context){
                    return MyHomePage();
                  })
              );
            },
          ),
        ),
      ),
    );
  }
}

即可

posted on 2019-08-28 22:33  LoaderMan  阅读(768)  评论(0编辑  收藏  举报

导航