| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- import 'package:bbyyy/https/my_request.dart';
- import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
- import 'package:bbyyy/my_tools/event_bus.dart';
- import 'package:bbyyy/my_tools/global.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_datas.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:bbyyy/paegs/home_page/home_page.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'home_page.dart';
- import 'root_page_view.dart';
- class RootPage1 extends StatefulWidget {
- @override
- _RootPage1State createState() => _RootPage1State();
- }
- class _RootPage1State extends State<RootPage1> {
- PageController pageController = PageController(initialPage: 0);
- DateTime lastPopTime;
- @override
- void initState() {
- super.initState();
- MyCookie().initP();
- // MyData().init(context);
- EventBus().on('toLogin', (arg) {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return Material(
- color: Colors.black12,
- child: Center(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- color: Colors.white,
- ),
- height: 180,
- margin: EdgeInsets.symmetric(horizontal: 18),
- padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Column(
- children: [
- Expanded(
- child: Center(
- child: Container(
- child: MyViews().myText('完整体验请前往注册登录', MyColors.c333333, 14),
- margin: EdgeInsets.symmetric(horizontal: 20),
- ),
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.only(bottom: 12),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 10),
- child: Row(
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- Navigator.pop(context);
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(20),
- bottomLeft: Radius.circular(20),
- ),
- border: Border.all(
- color: MyColors.cFF4233, width: 1.1),
- color: Colors.white),
- child: MyViews().myText('下次再说', MyColors.cFF4233, 14),
- height: 40,
- alignment: Alignment.center,
- ),
- ),
- ),
- Expanded(
- child: GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: (){
- Navigator.pop(context);
- MyCookie().clean();
- navigatorKey.currentState.pushNamedAndRemoveUntil('/loginPage', ModalRoute.withName("/loginPage"));
- },
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- color: MyColors.cFF4233),
- height: 40,
- child: MyViews().myText('现在就去', Colors.white, 14),
- alignment: Alignment.center,
- ),
- ),
- )
- ],
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- ),
- );
- },
- );
- });
- }
- @override
- Widget build(BuildContext context) {
- return WillPopScope(
- onWillPop: () async {
- if (lastPopTime == null ||
- DateTime.now().difference(lastPopTime) > Duration(seconds: 2)) {
- lastPopTime = DateTime.now();
- EasyLoading.showToast('再按一次退出');
- } else {
- lastPopTime = DateTime.now();
- await SystemChannels.platform.invokeMethod('SystemNavigator.pop');
- }
- return false;
- },
- child: Scaffold(
- backgroundColor: Colors.transparent,
- body: Column(
- children: [
- Expanded(
- child: PageView(
- controller: pageController,
- children: [HomePage1()],
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- RootPageView1().bottomNavigationBar(),
- ],
- ),
- ),
- );
- }
- }
|