/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by julian on 2023-10-16 * */ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/constants.dart'; import '../../utilities/extensions/extensions.dart'; import '../../utilities/text_styles.dart'; enum FusionOption { continuous, custom; } class FusionRoundCountSelectSheet extends HookWidget { const FusionRoundCountSelectSheet({ super.key, required this.currentOption, }); final FusionOption currentOption; @override Widget build(BuildContext context) { final option = useState(currentOption); return WillPopScope( onWillPop: () async { Navigator.of(context).pop(option.value); return false; }, child: Container( decoration: BoxDecoration( color: Theme.of(context).extension()!.popupBG, borderRadius: const BorderRadius.vertical( top: Radius.circular(20), ), ), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 10, bottom: 0, ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Center( child: Container( decoration: BoxDecoration( color: Theme.of(context) .extension()! .textFieldDefaultBG, borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius, ), ), width: 60, height: 4, ), ), const SizedBox( height: 36, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Rounds of fusion", style: STextStyles.pageTitleH2(context), textAlign: TextAlign.left, ), const SizedBox( height: 20, ), for (int i = 0; i < FusionOption.values.length; i++) Column( children: [ GestureDetector( onTap: () { option.value = FusionOption.values[i]; Navigator.of(context).pop(option.value); }, child: Container( color: Colors.transparent, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Column( // mainAxisAlignment: MainAxisAlignment.start, // children: [ SizedBox( width: 20, height: 20, child: Radio( activeColor: Theme.of(context) .extension()! .radioButtonIconEnabled, value: FusionOption.values[i], groupValue: option.value, onChanged: (_) { option.value = FusionOption.values[i]; Navigator.of(context).pop(option.value); }, ), ), // ], // ), const SizedBox( width: 12, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( FusionOption.values[i].name.capitalize(), style: STextStyles.titleBold12(context), textAlign: TextAlign.left, ), const SizedBox( height: 2, ), Text( FusionOption.values[i] == FusionOption.continuous ? "Keep fusing until manually stopped" : "Stop after a set number of fusions", style: STextStyles.itemSubtitle12(context) .copyWith( color: Theme.of(context) .extension()! .textDark3, ), textAlign: TextAlign.left, ), ], ), ], ), ), ), const SizedBox( height: 16, ), ], ), const SizedBox( height: 16, ), ], ), ], ), ), ), ); } }