| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:trackoffical_app/generated/assets.dart';
- import 'package:trackoffical_app/screen.dart';
- import 'package:trackoffical_app/service/app.dart';
- import 'package:trackoffical_app/service/mock.dart';
- import 'package:trackoffical_app/view/ingame/dialog/dialog_base.dart';
- import '../../../styles/theme.dart';
- import 'dialog_button.dart';
- Widget _elem(String iconSrc, String title) {
- final style = TextStyle(
- fontSize: 45.8.rpx,
- fontWeight: FontWeight.w500,
- color: const Color(0xff333333));
- return Container(
- decoration: BoxDecoration(
- color: Colors.white, borderRadius: BorderRadius.circular(1.2.wp)),
- padding: EdgeInsets.only(left: 2.55.wp, top: 1.78.wp, bottom: 1.78.wp),
- margin: EdgeInsets.only(bottom: 3.81.wp),
- child: Row(
- children: [
- Image.asset(iconSrc, height: 9.16.wp),
- SizedBox(width: 9.5.rpx),
- Expanded(
- child: Text(
- title,
- style: style.copyWith(fontSize: 34.35.rpx),
- )),
- ],
- ));
- }
- class DialogStartWarn extends StatefulWidget {
- const DialogStartWarn({super.key});
- @override
- State<StatefulWidget> createState() {
- return DialogStartWarnState();
- }
- }
- class DialogStartWarnState extends State<DialogStartWarn> {
- @override
- Widget build(BuildContext context) {
- const title = '为了获得更好的体验';
- const titleColor = Color(0xFFce0000);
- return dialogTitle(
- title,
- titleColor,
- Column(children: [
- _elem(Assets.imagesIcWarnSound, '调大手机音量'),
- _elem(Assets.imagesIcWarnVibrate, '开启手机震动'),
- _elem(Assets.imagesIcWarnBrightness, '强光下将屏幕调至最亮'),
- GestureDetector(
- onTap: () {
- setState(() {
- App.to.userProfile.isEnableInGameStartWarn.val =
- !App.to.userProfile.isEnableInGameStartWarn.val;
- });
- },
- child: Row(children: [
- Container(
- width: 10.36.wp,
- height: 10.36.wp,
- padding: EdgeInsets.all(2.0.wp),
- child: Stack(
- children: [
- Image.asset(Assets.imagesIcSelectRect),
- !App.to.userProfile.isEnableInGameStartWarn.val
- ? Image.asset(Assets.imagesIcSelectRectSelected)
- : const SizedBox()
- ],
- )),
- const Text('下次不再提醒'),
- ])),
- SizedBox(height: 4.0.wp),
- dialogButton('确定', () {
- Get.back();
- })
- ]));
- }
- }
- Future<void> dialogStartWarn() async{
- await Get.dialog(const DialogStartWarn(), barrierDismissible: true);
- return;
- }
- class _Empty extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- SizeFit.screenInit(context);
- return Scaffold(
- floatingActionButton: FloatingActionButton(onPressed: () {
- dialogStartWarn();
- }),
- );
- }
- }
- void main() async {
- Mock.initServices();
- runApp(GetMaterialApp(theme: appThemeData(), home: _Empty()));
- }
|