74 lines
2.5 KiB
Dart
74 lines
2.5 KiB
Dart
import 'dart:async';
|
||
import 'dart:io';
|
||
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter/services.dart';
|
||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||
import 'package:talk/tools/home_page.dart';
|
||
import 'package:talk/tools/login/login_page.dart';
|
||
import 'package:talk/tools/me/setting_page.dart';
|
||
import 'package:talk/tools/shop/account_page.dart';
|
||
import 'package:talk/tools/shop/problem_page.dart';
|
||
import 'package:talk/tools/shop/shop_page.dart';
|
||
import 'package:talk/tools/shop/transaction_page.dart';
|
||
import 'package:talk/tools/search/search_page.dart';
|
||
import 'package:talk/tools/start_page.dart';
|
||
|
||
import 'common/Global.dart';
|
||
|
||
Future<void> main() async {
|
||
await runZonedGuarded(() async {
|
||
WidgetsFlutterBinding.ensureInitialized();
|
||
Global.initialize().then((e) {
|
||
Global();
|
||
runApp(const ChatApp());
|
||
if (Platform.isAndroid) {
|
||
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。
|
||
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
||
}
|
||
});
|
||
}, (error, stackTrace) {
|
||
print("error==$error");
|
||
});
|
||
}
|
||
|
||
class ChatApp extends StatefulWidget {
|
||
const ChatApp({super.key});
|
||
|
||
@override
|
||
State<ChatApp> createState() => _ChatAppState();
|
||
}
|
||
|
||
class _ChatAppState extends State<ChatApp> {
|
||
@override
|
||
void initState() {
|
||
// TODO: implement initState
|
||
super.initState();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return MaterialApp(
|
||
title: 'FondleTalk',
|
||
home: const StartPage(),
|
||
//注册路由
|
||
routes: <String, WidgetBuilder>{
|
||
'/HomePage': (BuildContext context) => const HomePage(),
|
||
'/SearchPage': (BuildContext context) => const SearchPage(),
|
||
'/LoginPage': (BuildContext context) => const LoginPage(),
|
||
'/AccountPage': (BuildContext context) => const AccountPage(),
|
||
'/TransactionPage': (BuildContext context) => const TransactionPage(),
|
||
'/ProblemPage': (BuildContext context) => const ProblemPage(),
|
||
'/ShopPage': (BuildContext context) => const ShopPage(),
|
||
'/SettingPage': (BuildContext context) => const SettingPage(),
|
||
},
|
||
debugShowMaterialGrid: false,
|
||
//显示网格
|
||
debugShowCheckedModeBanner: false,
|
||
//去掉右上角的debug
|
||
builder: EasyLoading.init(),
|
||
);
|
||
}
|
||
}
|