import 'package:flutter/material.dart'; import 'package:flutter_auth/models/config.dart'; import 'package:flutter_auth/pages/welcome/welcome_image.dart'; import 'package:flutter_auth/pages/background.dart'; import 'package:flutter_auth/routes.dart'; import 'package:flutter_auth/views/responsive.dart'; /// Description: welcome page /// Time : 08/24/2023 Thursday /// Author : liuyuqi.gov@msn.cn class WelcomePage extends StatefulWidget { const WelcomePage({super.key}); @override State createState() => _WelcomePageState(); } class _WelcomePageState extends State { @override Widget build(BuildContext context) { return Background( child: SingleChildScrollView( child: SafeArea( child: Responsive( mobile: buildWelcomeMobile(), desktop: buildWelcomeDesktop()), ), )); } Widget buildWelcomeMobile() { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const WelcomeImage(), Row( children: [ const Spacer(), Expanded( flex: 8, child: buildLoginAndSignupBtn(), ), const Spacer() ], ) ], ); } Widget buildWelcomeDesktop() { return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ const Expanded(child: WelcomeImage()), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 450, child: buildLoginAndSignupBtn(), ) ], )) ], ); } Widget buildLoginAndSignupBtn() { return Column( children: [ Hero( tag: "login_btn", child: ElevatedButton( child: const Text("登录"), onPressed: () { // Navigator.push(context, MaterialPageRoute(builder: (context) { // return const LoginPage(); // })); Routes.go(context, Routes.login); }, ), ), const SizedBox( height: 16, ), ElevatedButton( onPressed: () { Routes.go(context, Routes.register); }, style: ElevatedButton.styleFrom( backgroundColor: kPrimaryLightColor, elevation: 0), child: const Text( "注册", style: TextStyle(color: Colors.black), ), ), ], ); } }