mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-26 11:14:11 +01:00
Cw 973 in app gift card redemption flow plus UI (#2285)
* refactor: cleanup cake_pay folder * refactor: add My Cards tab on the main screen * ui: add user card item * refactor: cakePay purchase flow * feat: add user card info * refactor: auth flow * refactor: theme data * revert * Update qr_widget.dart * fix: update with new themes * minor fixes * feat: put redemption flow under a feature flag * feat: implement simulated purchasing flow in debug mode * feat: support LTC and MWEB payments * Update savings_page.dart * fix: UI fixes * add Cake Pay transaction sent bottom sheet * localization * Update cake_pay_buy_card_page.dart * addressing review comments * fix marge conflicts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:cake_wallet/cake_pay/cake_pay_service.dart';
|
||||
import 'package:cake_wallet/cake_pay/src/services/cake_pay_service.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'cake_features_view_model.g.dart';
|
||||
|
||||
@@ -1,67 +1,57 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DropdownFilterList extends StatefulWidget {
|
||||
DropdownFilterList({
|
||||
class DropdownFilterList extends StatelessWidget {
|
||||
const DropdownFilterList({
|
||||
Key? key,
|
||||
required this.items,
|
||||
this.itemPrefix,
|
||||
this.textStyle,
|
||||
required this.caption,
|
||||
required this.selectedItem,
|
||||
required this.onItemSelected,
|
||||
this.itemPrefix,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<String> items;
|
||||
final String? itemPrefix;
|
||||
final TextStyle? textStyle;
|
||||
final String caption;
|
||||
final String selectedItem;
|
||||
final Function(String) onItemSelected;
|
||||
|
||||
@override
|
||||
_DropdownFilterListState createState() => _DropdownFilterListState();
|
||||
}
|
||||
|
||||
class _DropdownFilterListState extends State<DropdownFilterList> {
|
||||
String? selectedValue;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
selectedValue = widget.selectedItem;
|
||||
}
|
||||
final String? itemPrefix;
|
||||
final ValueChanged<String> onItemSelected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButtonHideUnderline(
|
||||
child: Container(
|
||||
child: DropdownButton<String>(
|
||||
isExpanded: true,
|
||||
icon: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Icon(Icons.arrow_drop_down, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
],
|
||||
),
|
||||
),
|
||||
dropdownColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
child: DropdownButton<String>(
|
||||
isDense: true,
|
||||
dropdownColor: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
items: widget.items
|
||||
.map((item) => DropdownMenuItem<String>(
|
||||
alignment: Alignment.bottomCenter,
|
||||
value: item,
|
||||
child: AutoSizeText('${widget.itemPrefix ?? ''} $item', style: widget.textStyle),
|
||||
))
|
||||
selectedItemBuilder: (context) => items
|
||||
.map(
|
||||
(item) => Text(
|
||||
'${itemPrefix ?? ''} $item',
|
||||
style: Theme.of(context).textTheme.titleMedium!,
|
||||
maxLines: 1,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
value: selectedValue,
|
||||
onChanged: (newValue) {
|
||||
setState(() => selectedValue = newValue);
|
||||
widget.onItemSelected(newValue!);
|
||||
items: items
|
||||
.map(
|
||||
(item) => DropdownMenuItem<String>(
|
||||
value: item,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'${itemPrefix ?? ''} $item',
|
||||
style: (const TextStyle()).copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
value: selectedItem,
|
||||
onChanged: (value) {
|
||||
if (value != null) onItemSelected(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
icon: Icon(Icons.keyboard_arrow_down_outlined,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user