Cw 372 improve monero haven account selection picker (#939)

* refactor: Improve Monero/Haven account selection picker

* feat: If the amount would be wrapped, instead display it under the account name

* fix: balance str

* refactor: add theme changes

* refactor: remove duplicate observer
This commit is contained in:
Rafael Saes
2023-07-11 03:40:43 +03:00
committed by GitHub
parent c01321008b
commit cb0ca169fb
3 changed files with 182 additions and 172 deletions
@@ -0,0 +1,91 @@
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/picker_wrapper_widget.dart';
class PickerInnerWrapperWidget extends StatelessWidget {
PickerInnerWrapperWidget(
{required this.children, this.title, this.itemsHeight});
final List<Widget> children;
final String? title;
final double? itemsHeight;
@override
Widget build(BuildContext context) {
final mq = MediaQuery.of(context);
final bottom = mq.viewInsets.bottom;
final height = mq.size.height - bottom;
double containerHeight = height * 0.65;
if (bottom > 0) {
// increase a bit or it gets too squished in the top
containerHeight = height * 0.75;
}
if (title != null) {
return PickerWrapperWidget(
hasTitle: true,
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Text(
title!,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
decoration: TextDecoration.none,
color: Colors.white),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
color: Theme.of(context).textTheme.displayLarge!.decorationColor!,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
itemsHeight != null && itemsHeight! <= containerHeight
? itemsHeight!
: containerHeight,
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
),
child: Column(
children: children,
),
),
),
),
)
],
);
}
return PickerWrapperWidget(
hasTitle: false,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
color: Theme.of(context).textTheme.displayLarge!.decorationColor!,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: containerHeight,
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
),
child: Column(
children: children,
),
),
),
),
)
],
);
}
}