| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- import 'package:flutter/material.dart';
- import 'package:wanna_battle/model/PlayerInfo.dart';
- import 'package:flutter/cupertino.dart';
- import 'GuidePage.dart';
- import 'MatchPage.dart';
- import 'RankList.dart';
- import '../widget/BottomTabs.dart';
- import 'UserPage.dart';
- import '../net/HttpManager.dart';
- import '../net/Result.dart';
- import '../widget/Dialog.dart';
- import 'Appeal.dart';
- import '../model/HouseInfo.dart';
- import 'RoomInfo.dart';
- class HomePage extends StatefulWidget {
- @override
- _HomePageState createState() => _HomePageState();
- }
- class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin {
- TabController controller;
- Future<void> checkErrorPlayerInfo() async {
- final Result res = await HttpManager.get('playerInfo/getErrorPlayerInfo');
- print('&********');
- print(res.error);
- if (res.success) {
- final PlayerInfo playerInfo = PlayerInfo.fromJson(res.data);
- // MyDialog.showDialog(
- // context,
- // '由于系统性能安全策略问题导致本次比赛结果上传失败,你可以上传本次比赛结果照片进行结果申诉',
- // isCancel: true,
- // onsubmit: () {
- // Navigator.push(context, CupertinoPageRoute(builder: (context) => Appeal(playerInfo)));
- // },
- // );
- final res1 = await HttpManager.get('houseInfo/getOne', data: {'id': playerInfo.houseId});
- if (res1.success && res1.data != null) {
- Navigator.push(
- context,
- CupertinoPageRoute(
- builder: (context) => RoomInfo(
- roomId:res1.data['id'].toString(),
- // playerInfo: playerInfo,
- // interrupted: true,
- ),
- ),
- );
- }
- } else {
- //引导页
- showGruide();
- }
- }
- @override
- void initState() {
- super.initState();
- controller = new TabController(length: 3, vsync: this);
- Future.delayed(Duration.zero, () {
- checkErrorPlayerInfo();
- });
- }
- @override
- void dispose() {
- controller.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: WillPopScope(
- child: Container(
- color: Color(0xFF2E3049),
- child: new MyTabBarView(
- controller: controller,
- children: <Widget>[MatchPage(), RankList(), UserPage()],
- ),
- ),
- onWillPop: () {
- return Future.value(true);
- },
- ),
- bottomNavigationBar: new Container(
- color: Color(0xFF23253C),
- height: 49,
- child: new MyTabBar(
- controller: controller,
- labelColor: Theme.of(context).primaryColor,
- unselectedLabelColor: Color(0xFF46496C),
- indicatorColor: Color(0xFF171721),
- labelPadding: EdgeInsets.zero,
- labelStyle: TextStyle(fontSize: 11, height: 1),
- tabs: <Widget>[
- new MyTab(
- text: "赛事",
- icon: ImageIcon(AssetImage('images/tabbar_icon_01_pre.png'), size: 28),
- ),
- MyTab(
- text: "排行",
- icon: ImageIcon(AssetImage('images/tabbar_icon_02.png'), size: 28),
- ),
- new MyTab(
- text: "我的",
- icon: ImageIcon(AssetImage('images/tabbar_icon_03.png'), size: 28),
- ),
- ],
- ),
- )
- // floatingActionButton: floatWidget(),
- // floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
- );
- }
- void showGruide() {
- Navigator.of(context).push(PageRouteBuilder(
- opaque: false,
- transitionDuration: Duration(milliseconds: 300),
- transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
- return FadeTransition(
- opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
- child: child,
- );
- },
- pageBuilder: (BuildContext context, _, __) {
- return GuidePage();
- }));
- }
- }
|