12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import 'package:eitc_erm_app/select_clinic.dart';
- import 'package:eitc_erm_app/utils/Constants.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_localizations/flutter_localizations.dart';
- import 'bottom_navigation.dart';
- import 'doctor_talk_list.dart';
- import 'login.dart';
- void main() {
- runApp(const Main());
- }
- class Main extends StatelessWidget {
- const Main({super.key});
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- localizationsDelegates: const [
- GlobalMaterialLocalizations.delegate,
- GlobalWidgetsLocalizations.delegate,
- GlobalCupertinoLocalizations.delegate, //多加这行代码
- ],
- supportedLocales: const [
- Locale('en', 'US'), // 美国英语
- Locale('zh', 'CN'), // 中文简体
- //其它Locales
- ],
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: SplashScreen(),
- routes: {
- '/login': (context) => Login(),
- '/home': (context) => BottomNavigationWidget(),
- '/doctor': (context) => DoctorTalkList(),
- '/selectClinic': (context) => SelectClinic(""),
- },
- );
- }
- }
- class SplashScreen extends StatefulWidget {
- @override
- _SplashScreenState createState() => _SplashScreenState();
- }
- class _SplashScreenState extends State<SplashScreen> {
- @override
- void initState() {
- super.initState();
- // 在这里可以进行一些初始化操作,如加载数据等
- // 通过Future.delayed方法模拟加载时间
- Future.delayed(Duration(seconds: 3), () async {
- /*if(!(await Utils.readData("token")).isEmpty) {
- Global.token = await Utils.readData("token");
- Navigator.pushReplacementNamed(context, '/home');
- } else if(!(await Utils.readData("doctorToken")).isEmpty) {
- Global.token = await Utils.readData("doctorToken");
- Navigator.pushReplacementNamed(context, '/doctor');
- } else
- Navigator.pushReplacementNamed(context, '/login');*/
- Navigator.pushReplacementNamed(context, '/selectClinic');
- });
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- FlutterLogo(
- size: 100,
- ),
- SizedBox(height: 16),
- Text(
- '智慧口腔诊所',
- style: TextStyle(
- fontSize: 24,
- fontWeight: FontWeight.bold,
- ),
- ),
- SizedBox(height: 16),
- CircularProgressIndicator(),
- ],
- ),
- ),
- );
- }
- }
|