welcome_page.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_tracker/model/config.dart';
  3. import 'package:flutter_tracker/pages/login_page.dart';
  4. import 'package:flutter_tracker/pages/register_page.dart';
  5. import 'package:flutter_tracker/utils/app_util.dart';
  6. class WelComePage extends StatefulWidget {
  7. const WelComePage({Key key}) : super(key: key);
  8. @override
  9. _WelComePageState createState() => _WelComePageState();
  10. }
  11. class _WelComePageState extends State<WelComePage> {
  12. @override
  13. Widget build(BuildContext context) {
  14. return Stack(
  15. children: [
  16. Container(
  17. child: Image.asset(
  18. "assets/images/home.jpg",
  19. fit: BoxFit.cover,
  20. width: double.infinity,
  21. height: double.infinity,
  22. ),
  23. ),
  24. Positioned(
  25. bottom: 80,
  26. child: Container(
  27. width: MediaQuery.of(context).size.width,
  28. alignment: Alignment.center,
  29. child: Row(
  30. mainAxisAlignment: MainAxisAlignment.center,
  31. children: [
  32. Container(
  33. width: 150,
  34. child: InkWell(
  35. onTap: () {
  36. // 登录
  37. Navigator.of(context).push(
  38. MaterialPageRoute(builder: (context) => LoginPage()));
  39. },
  40. child: Container(
  41. width: double.infinity,
  42. height: AppUtil.height(100),
  43. padding: EdgeInsets.only(
  44. right: AppUtil.width(20), left: AppUtil.width(20)),
  45. decoration: BoxDecoration(
  46. gradient: LinearGradient(colors: [
  47. ThemeColor.loignColor,
  48. ThemeColor.loignColor
  49. ]),
  50. borderRadius: BorderRadius.circular(10),
  51. boxShadow: [
  52. BoxShadow(
  53. offset: Offset(1.0, 5.0),
  54. color: ThemeColor.loignColor,
  55. blurRadius: 5.0,
  56. )
  57. ]),
  58. child: Center(
  59. child: Text(
  60. "登录",
  61. style: TextStyle(fontSize: 20, color: Colors.white),
  62. ),
  63. ),
  64. ),
  65. ),
  66. ),
  67. Container(
  68. width: 150,
  69. child: InkWell(
  70. onTap: () {
  71. //注册
  72. Navigator.of(context).push(MaterialPageRoute(
  73. builder: (context) => RegisterPage()));
  74. },
  75. child: Container(
  76. margin: EdgeInsets.only(left: 20.0),
  77. width: double.infinity,
  78. height: AppUtil.height(100),
  79. padding: EdgeInsets.only(
  80. right: AppUtil.width(20), left: AppUtil.width(20)),
  81. decoration: BoxDecoration(
  82. gradient: LinearGradient(colors: [
  83. ThemeColor.loignColor,
  84. ThemeColor.loignColor
  85. ]),
  86. borderRadius: BorderRadius.circular(10),
  87. boxShadow: [
  88. BoxShadow(
  89. offset: Offset(1.0, 5.0),
  90. color: ThemeColor.loignColor,
  91. blurRadius: 5.0,
  92. )
  93. ]),
  94. child: Center(
  95. child: Text(
  96. "注册",
  97. style: TextStyle(fontSize: 20, color: Colors.white),
  98. ),
  99. ),
  100. ),
  101. ),
  102. ),
  103. ],
  104. ),
  105. ),
  106. )
  107. ],
  108. );
  109. }
  110. }