import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_green/routes/routes.dart'; /// 欢迎页面:登录、注册,忘记密码 class WelcomePage extends StatefulWidget { @override _WelcomePageState createState() => _WelcomePageState(); } class _WelcomePageState extends State { @override Widget build(BuildContext context) { return Scaffold( body: AnnotatedRegion( value: SystemUiOverlayStyle.light, child: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/background.jpg"), ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( flex: 3, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 65, height: 65, margin: EdgeInsets.only( left: 30, ), padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), ), child: Image( image: AssetImage("assets/images/leaf.jpg"), ), ), ], ), ), Expanded( flex: 6, child: Container( padding: EdgeInsets.symmetric(horizontal: 28), child: Text( "Everyone should live with a little more green", overflow: TextOverflow.fade, style: TextStyle( color: Colors.white, fontSize: 41, fontWeight: FontWeight.bold), ), ), ), Expanded( flex: 3, child: Container( padding: EdgeInsets.symmetric(horizontal: 29), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( flex: 4, child: GestureDetector( onTap: nextScreen, child: Container( decoration: BoxDecoration( color: Color(0xFf142e32).withOpacity(0.93), borderRadius: BorderRadius.circular(20)), width: double.infinity, child: Center( child: Text( "Sign up", style: TextStyle( color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold), ), ), ), ), ), Expanded( flex: 2, child: Container(), ), Expanded( flex: 4, child: GestureDetector( onTap: () { Navigator.of(context).pushNamed(Routes.loginPage); }, child: Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20)), width: double.infinity, child: Center( child: Text( "Sign in", style: TextStyle( color: Color(0xFF265e59), fontSize: 30, fontWeight: FontWeight.bold), ), ), ), ), ), ], ), ), ), Expanded( flex: 2, child: Center( child: GestureDetector( onTap: nextScreen, child: Text( "Forgot password?", style: TextStyle( color: Colors.white, fontSize: 22, decoration: TextDecoration.underline), ), ), ), ), ], ), ), ), ); } nextScreen() { Navigator.of(context).pushNamed(Routes.homePage); } }