Skip to content
Snippets Groups Projects
Select Git revision
  • 4bfb3a6fd6a9a86332afaf01b4173c8778862b11
  • master default protected
  • 27-upgrade-framework-and-dependencies
  • 9-improve-app-metadata
  • 2-add-api-call-to-get-and-display-user-data
  • Release_0.8.0_22 protected
  • Release_0.7.2_21 protected
  • Release_0.7.1_20 protected
  • Release_0.7.0_19 protected
  • Release_0.6.0_18 protected
  • Release_0.5.0_17 protected
  • Release_0.4.0_16 protected
  • Release_0.3.2_15 protected
  • Release_0.3.1_14 protected
  • Release_0.3.0_13 protected
  • Release_0.2.1_12 protected
  • Release_0.2.0_11 protected
  • Release_0.1.2_10 protected
  • Release_0.1.1_9 protected
  • Release_0.1.0_8 protected
  • Release_0.0.7_7 protected
  • Release_0.0.6_6 protected
  • Release_0.0.5_5 protected
  • Release_0.0.4_4 protected
  • Release_0.0.3_3 protected
25 results

app_bar.dart

Blame
  • parameters_layout.dart 5.11 KiB
    import 'package:flutter/material.dart';
    import 'package:flutter_bloc/flutter_bloc.dart';
    
    import 'package:minehunter/config/default_game_settings.dart';
    import 'package:minehunter/config/default_global_settings.dart';
    import 'package:minehunter/cubit/settings_game_cubit.dart';
    import 'package:minehunter/cubit/settings_global_cubit.dart';
    import 'package:minehunter/ui/parameters/parameter_image.dart';
    import 'package:minehunter/ui/parameters/parameter_painter.dart';
    import 'package:minehunter/ui/widgets/actions/button_delete_saved_game.dart';
    import 'package:minehunter/ui/widgets/actions/button_game_start_new.dart';
    import 'package:minehunter/ui/widgets/actions/button_resume_saved_game.dart';
    
    class ParametersLayout extends StatelessWidget {
      const ParametersLayout({super.key, required this.canResume});
    
      final bool canResume;
    
      final double separatorHeight = 8.0;
    
      @override
      Widget build(BuildContext context) {
        final List<Widget> lines = [];
    
        // Game settings
        for (String code in DefaultGameSettings.availableParameters) {
          lines.add(Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: buildParametersLine(
              code: code,
              isGlobal: false,
            ),
          ));
    
          lines.add(SizedBox(height: separatorHeight));
        }
    
        lines.add(SizedBox(height: separatorHeight));
    
        if (canResume == false) {
          // Start new game
          lines.add(const Expanded(
            child: StartNewGameButton(),
          ));
        } else {
          // Resume game
          lines.add(const Expanded(
            child: ResumeSavedGameButton(),
          ));
          // Delete saved game
          lines.add(SizedBox.square(
            dimension: MediaQuery.of(context).size.width / 4,
            child: const DeleteSavedGameButton(),
          ));
        }
    
        lines.add(SizedBox(height: separatorHeight));
    
        // Global settings
        for (String code in DefaultGlobalSettings.availableParameters) {
          lines.add(Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: buildParametersLine(
              code: code,
              isGlobal: true,
            ),
          ));
    
          lines.add(SizedBox(height: separatorHeight));
        }