import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/common/Images.dart';
import 'package:netrain_flutter_app/douwen/custom/BaseView.dart';
import 'package:netrain_flutter_app/douwen/custom/BaseViewModel.dart';

import 'Demo2.dart';
import 'secondpage.dart';

void main() {
  runApp(MyApp());
  // runApp(Login());
  // runApp(TestPage());

  print("启动");
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  BaseViewModel viewModel = BaseViewModel();

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
        child: MaterialApp(
          title: 'Flutter Demo',
          // initialRoute: "/",
          theme: ThemeData(
            primarySwatch: Colors.blue,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          initialRoute: "key1",
          routes: <String, WidgetBuilder>{
            "key1": (context) => Scaffold(
                  appBar: AppBar(
                    title: Text("这个是标题"),
                  ),
                  body: Demo2(),
                ),
            "key2": (context) => Second()
          },
        ),
        onWillPop: () async {
          Fluttertoast.showToast(msg: "退出");
          return true;
        });
  }

  _item(String title, VoidCallback onPressed) {
    return Container(
      child: RaisedButton(
        onPressed: onPressed,
        child: Text(title),
      ),
    );
  }
}
