content: import 'package:bb_mobile/core/exchange/domain/entity/order.dart';
  import 'package:bb_mobile/core/widgets/scrollable_column.dart';
  import 'package:bb_mobile/features/sell/ui/widgets/sell_amount_currency_dropdown.dart';
  import 'package:bb_mobile/features/sell/ui/widgets/sell_amount_input_bottom_buttons.dart';
  import 'package:bb_mobile/features/sell/ui/widgets/sell_amount_input_field.dart';
  import 'package:flutter/material.dart';
  import 'package:gap/gap.dart';
  import 'package:go_router/go_router.dart';
  
  class SellScreen extends StatefulWidget {
    const SellScreen({super.key});
  
    @override
    State<SellScreen> createState() => _SellScreenState();
  }
  
  class _SellScreenState extends State<SellScreen> {
    final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
    late final TextEditingController _amountController = TextEditingController();
    bool _isFiatCurrencyInput = true;
    FiatCurrency? _fiatCurrency;
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          // Adding the leading icon button here manually since we are in the first
          // route of a shellroute and so no back button is provided by default.
          leading:
              context.canPop()
                  ? BackButton(
                    onPressed: () {
                      context.pop();
                    },
                  )
                  : null,
          title: const Text('Sell Bitcoin'),
        ),
        body: SafeArea(
          child: Form(
            key: _formKey,
            child: ScrollableColumn(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                const Gap(24.0),
                SellAmountInputField(
                  amountController: _amountController,
                  fiatCurrency: _fiatCurrency,
                  isFiatCurrencyInput: _isFiatCurrencyInput,
                  onIsFiatCurrencyInputChanged: (bool isFiat) {
                    setState(() {
                      _isFiatCurrencyInput = isFiat;
                    });
                  },
                ),
                const Gap(16.0),
                SellAmountCurrencyDropdown(
                  selectedCurrency: _fiatCurrency?.code,
                  onCurrencyChanged: (String currencyCode) {
                    setState(() {
                      _fiatCurrency = FiatCurrency.fromCode(currencyCode);
                    });
                  },
                ),
                const Spacer(),
                SellAmountInputBottomButtons(
                  formKey: _formKey,
                  amountController: _amountController,
                  isFiatCurrencyInput: _isFiatCurrencyInput,
                  fiatCurrency: _fiatCurrency,
                ),
                const Gap(16.0),
              ],
            ),
          ),
        ),
      );
    }
  
    @override
    void dispose() {
      _amountController.dispose();
      super.dispose();
    }
  }
  