| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:trackoffical_app/service/game/game.dart';
- import 'dialog/dialog_finish_result.dart';
- import '../../styles/theme.dart';
- class SettlementController extends GetxController{
- final tip = '正在计算'.obs;
- final game = GameService.to;
- _init()async{
- while(!isClosed){
- await Future.delayed(100.milliseconds);
- if(game.errorMsg.value.isNotEmpty){
- tip.value = game.errorMsg.value;
- }
- if(game.status != GameStatus.settlement){
- break;
- }
- }
- dialogFinishResult(game.lastGameSettlement);
- // Get.offAll(() => GameFinish3View(data: game.lastGameSettlement));
- }
- @override
- void onReady() {
- _init();
- }
- }
- class SettlementView extends GetView<SettlementController>{
- const SettlementView({super.key});
- static Bindings bindings() {
- return BindingsBuilder(() {
- Get.put(SettlementController());
- });
- }
- static show(){
- Get.offAll(
- ()=>const SettlementView(),
- binding: bindings()
- );
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: [
- Obx(() => Text(controller.tip.value, style: context.textTheme.titleLarge)),
- Image.asset(
- 'assets/images/loading.gif',
- height: 60,
- width: 60,
- )
- ],
- )
- ),
- );
- }
- }
- void main() async {
- Get.put(SettlementController());
- runApp(GetMaterialApp(theme: appThemeData(), home: const SettlementView()));
- }
|