Files
2024-09-27 01:32:49 +08:00

144 lines
3.9 KiB
Dart
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
// 底部导航入口赋值绘制整个app
import 'package:flutter_app/view/components/BottomNavigationWidget.dart';
import 'package:intro_views_flutter/Models/page_view_model.dart';
import 'package:intro_views_flutter/intro_views_flutter.dart';
import 'package:flutter_app/R.dart';
class WelcomeWidget extends StatefulWidget {
// 这里接受一个 bool 用于下面的判断主要为了实现在设置页面也可以浏览查看app的启动欢迎页面
// 而不进行跳转
final bool enterAction;
WelcomeWidget(this.enterAction);
@override
State<StatefulWidget> createState() => _WelcomeWidget();
}
class _WelcomeWidget extends State<WelcomeWidget> {
// 启动页面的基本配置,一般从后端获取,这里直接写死
final pages = [
PageViewModel(
pageColor: Colors.orange,
body: Text(
'国内高清模特写真,为您带来视觉享受',
style: TextStyle(
fontSize: 17.0
),
),
title: Text(
'夜色社区-美图精选',
style: TextStyle(
fontSize: 30.0
),
),
textStyle: TextStyle(color: Colors.white),
mainImage: Image.asset(
R.libStaticImgLogoPng,
height: 285.0,
width: 285.0,
alignment: Alignment.center,
)
),
PageViewModel(
pageColor: const Color(0xFF03A9F4),
body: Text(
'基于谷歌开源UI框架Flutter + Dart语言开发的原生App为您带来更快更流畅的体验',
style: TextStyle(
fontSize: 17.0
),
),
title: Text(
'更快',
style: TextStyle(
fontSize: 30.0
),
),
textStyle: TextStyle(color: Colors.white),
mainImage: Image.asset(
R.libStaticImgAirplanePng,
height: 285.0,
width: 285.0,
alignment: Alignment.center,
)
),
PageViewModel(
pageColor: const Color(0xFF8BC34A),
body: Text(
'基于RSA非对称加密与HTTPS全面保障您的数据安全',
style: TextStyle(
fontSize: 17.0
),
),
title: Text(
'安全',
style: TextStyle(
fontSize: 30.0
),
),
mainImage: Image.asset(
R.libStaticImgHotelPng,
height: 285.0,
width: 285.0,
alignment: Alignment.center,
),
textStyle: TextStyle(color: Colors.white),
),
PageViewModel(
pageColor: const Color(0xFF607D8B),
body: Text(
'全面并且全力开发并支持AndroidiOSWeb桌面客户端为您提供随时随地的观影体验',
style: TextStyle(
fontSize: 17.0
),
),
title: Text(
'方便',
style: TextStyle(
fontSize: 30.0
),
),
mainImage: Image.asset(
R.libStaticImgTaxiPng,
height: 285.0,
width: 285.0,
alignment: Alignment.center,
),
textStyle: TextStyle(color: Colors.white),
),
];
@override
Widget build(BuildContext context) {
return Builder(
builder: (context) =>
IntroViewsFlutter(
pages,
onTapDoneButton: () {
if(widget.enterAction) {
// 使用 pushAndRemoveUntil 进入app后销毁之前的启动页面否则侧滑还能打开
Navigator.pushAndRemoveUntil(context,
new MaterialPageRoute(
builder: (BuildContext context) {
return new BottomNavigationWidget();
},
), (route) => route == null
);
}
},
skipText: Text("跳过"),
doneText: Text("进入"),
pageButtonTextStyles: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
), //IntroViewsFlutter
);
}
}