Skip to content
Snippets Groups Projects
Select Git revision
  • 92179000ce8a5e4ab8045f02414cba3c3526fef9
  • master default protected
  • 61-upgrade-framework-and-dependencies
  • 42-add-allowed-categories-in-settings-page
  • 44-improve-app-metadata
  • 23-add-tip-response-on-clic-on-button
  • Release_1.11.0_55 protected
  • Release_1.10.2_54 protected
  • Release_1.10.1_53 protected
  • Release_1.10.0_52 protected
  • Release_1.9.0_51 protected
  • Release_1.8.0_50 protected
  • Release_1.7.0_49 protected
  • Release_1.6.2_48 protected
  • Release_1.6.1_47 protected
  • Release_1.6.0_46 protected
  • Release_1.5.1_45 protected
  • Release_1.5.0_44 protected
  • Release_1.4.1_43 protected
  • Release_1.4.0_42 protected
  • Release_1.3.1_41 protected
  • Release_1.3.0_40 protected
  • Release_1.2.33_39 protected
  • Release_1.2.32_38 protected
  • Release_1.2.31_37 protected
  • Release_1.2.30_36 protected
26 results

parameters_layout.dart

Blame
  • parameters_layout.dart 4.35 KiB
    import 'package:flutter/material.dart';
    import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
    
    import 'package:petitbac/config/default_game_settings.dart';
    import 'package:petitbac/config/default_global_settings.dart';
    import 'package:petitbac/cubit/settings_game_cubit.dart';
    import 'package:petitbac/cubit/settings_global_cubit.dart';
    import 'package:petitbac/ui/parameters/parameter_widget.dart';
    import 'package:petitbac/ui/widgets/actions/button_delete_saved_game.dart';
    import 'package:petitbac/ui/widgets/actions/button_game_start_new.dart';
    import 'package:petitbac/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(Expanded(
          child: SizedBox(height: separatorHeight),
        ));
    
        if (canResume == false) {
          // Start new game
          lines.add(
            const AspectRatio(
              aspectRatio: 3,
              child: StartNewGameButton(),
            ),
          );
        } else {
          // Resume game
          lines.add(const AspectRatio(
            aspectRatio: 3,
            child: ResumeSavedGameButton(),
          ));
          // Delete saved game
          lines.add(SizedBox.square(
            dimension: MediaQuery.of(context).size.width / 5,
            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,