From 0ca1cd7157ade19a41cc9d8081ef4cc39144ae88 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Thu, 7 May 2020 13:07:51 +0300 Subject: [PATCH] CWA-209 | applied scroll to all receive page; reduced height of header tiles and address field; reduced font of address --- lib/src/screens/receive/receive_page.dart | 344 +++++++++--------- .../screens/receive/widgets/header_tile.dart | 4 +- 2 files changed, 173 insertions(+), 175 deletions(-) diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index 0916f3c89..59171da6c 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -75,7 +75,7 @@ class ReceiveBodyState extends State { final copyImage = Image.asset('assets/images/copy_content.png'); final currentColor = PaletteDark.menuList; - final notCurrentColor = Colors.transparent; + final notCurrentColor = PaletteDark.historyPanel; amountController.addListener(() { if (_formKey.currentState.validate()) { @@ -90,11 +90,10 @@ class ReceiveBodyState extends State { width: MediaQuery.of(context).size.width, color: PaletteDark.mainBackgroundColor, padding: EdgeInsets.only(top: 24), - child: Column( - children: [ - Flexible( - flex: 2, - child: Observer(builder: (_) { + child: SingleChildScrollView( + child: Column( + children: [ + Observer(builder: (_) { return Row( children: [ Spacer( @@ -119,193 +118,192 @@ class ReceiveBodyState extends State { ], ); }), - ), - Padding( - padding: EdgeInsets.all(24), - child: Row( - children: [ - Expanded( - child: Form( - key: _formKey, - child: BaseTextFormField( - controller: amountController, - keyboardType: TextInputType.numberWithOptions(decimal: true), - inputFormatters: [ - BlacklistingTextInputFormatter( - RegExp('[\\-|\\ |\\,]')) - ], - textAlign: TextAlign.center, - hintText: S.of(context).receive_amount, - borderColor: PaletteDark.walletCardText, - validator: (value) { - walletStore.validateAmount(value); - return walletStore.errorMessage; - }, - autovalidate: true, - ) - ) - ) - ], + Padding( + padding: EdgeInsets.all(24), + child: Row( + children: [ + Expanded( + child: Form( + key: _formKey, + child: BaseTextFormField( + controller: amountController, + keyboardType: TextInputType.numberWithOptions(decimal: true), + inputFormatters: [ + BlacklistingTextInputFormatter( + RegExp('[\\-|\\ |\\,]')) + ], + textAlign: TextAlign.center, + hintText: S.of(context).receive_amount, + borderColor: PaletteDark.walletCardText, + validator: (value) { + walletStore.validateAmount(value); + return walletStore.errorMessage; + }, + autovalidate: true, + ) + ) + ) + ], + ), ), - ), - Padding( - padding: EdgeInsets.only(left: 24, right: 24, bottom: 24), - child: Observer( - builder: (_) => GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: walletStore.subaddress.address)); - Scaffold.of(context).showSnackBar(SnackBar( - content: Text( - S.of(context).copied_to_clipboard, - style: TextStyle(color: Colors.white), + Padding( + padding: EdgeInsets.only(left: 24, right: 24, bottom: 24), + child: Observer( + builder: (_) => GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData( + text: walletStore.subaddress.address)); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text( + S.of(context).copied_to_clipboard, + style: TextStyle(color: Colors.white), + ), + backgroundColor: Colors.green, + duration: Duration(milliseconds: 500), + )); + }, + child: Container( + height: 48, + padding: EdgeInsets.only(left: 24, right: 24), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(27)), + color: PaletteDark.walletCardSubAddressField ), - backgroundColor: Colors.green, - duration: Duration(milliseconds: 500), - )); - }, - child: Container( - height: 54, - padding: EdgeInsets.only(left: 24, right: 24), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(27)), - color: PaletteDark.walletCardSubAddressField - ), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Text( - walletStore.subaddress.address, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, - color: Colors.white + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Text( + walletStore.subaddress.address, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.white + ), ), ), - ), - Padding( - padding: EdgeInsets.only(left: 12), - child: copyImage, - ) - ], + Padding( + padding: EdgeInsets.only(left: 12), + child: copyImage, + ) + ], + ), ), - ), - ) + ) + ), ), - ), - Flexible( - flex: 3, - child: ClipRRect( + Container( + decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(24), topRight: Radius.circular(24), ), - child: Container( - color: PaletteDark.historyPanel, - child: Observer( - builder: (_) => ListView.separated( - separatorBuilder: (context, index) => Divider( - height: 1, - color: PaletteDark.menuList, - ), - itemCount: subaddressListStore.subaddresses.length + 2, - itemBuilder: (context, index) { + color: PaletteDark.historyPanel, + ), + child: Observer( + builder: (_) => ListView.separated( + separatorBuilder: (context, index) => Divider( + height: 1, + color: PaletteDark.menuList, + ), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: subaddressListStore.subaddresses.length + 2, + itemBuilder: (context, index) { - if (index == 0) { - return HeaderTile( - onTap: () async { - await showDialog( - context: context, - builder: (BuildContext context) { - return AccountListPage(accountListStore: accountListStore); - } - ); - }, - title: walletStore.account.label, - icon: Icon( - Icons.arrow_forward_ios, - size: 14, - color: Colors.white, - ) - ); - } + if (index == 0) { + return HeaderTile( + onTap: () async { + await showDialog( + context: context, + builder: (BuildContext context) { + return AccountListPage(accountListStore: accountListStore); + } + ); + }, + title: walletStore.account.label, + icon: Icon( + Icons.arrow_forward_ios, + size: 14, + color: Colors.white, + ) + ); + } - if (index == 1) { - return HeaderTile( - onTap: () => Navigator.of(context) - .pushNamed(Routes.newSubaddress), - title: S.of(context).subaddresses, - icon: Icon( - Icons.add, - size: 20, - color: Colors.white, - ) - ); - } + if (index == 1) { + return HeaderTile( + onTap: () => Navigator.of(context) + .pushNamed(Routes.newSubaddress), + title: S.of(context).subaddresses, + icon: Icon( + Icons.add, + size: 20, + color: Colors.white, + ) + ); + } - index -= 2; + index -= 2; - return Observer( - builder: (_) { - final subaddress = subaddressListStore.subaddresses[index]; - final isCurrent = - walletStore.subaddress.address == subaddress.address; + return Observer( + builder: (_) { + final subaddress = subaddressListStore.subaddresses[index]; + final isCurrent = + walletStore.subaddress.address == subaddress.address; - final label = subaddress.label; - final address = subaddress.address; + final label = subaddress.label; + final address = subaddress.address; - return InkWell( - onTap: () => walletStore.setSubaddress(subaddress), - child: Container( - color: isCurrent ? currentColor : notCurrentColor, - padding: EdgeInsets.only( - left: 24, - right: 24, - top: 32, - bottom: 32 - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - label.isNotEmpty + return InkWell( + onTap: () => walletStore.setSubaddress(subaddress), + child: Container( + color: isCurrent ? currentColor : notCurrentColor, + padding: EdgeInsets.only( + left: 24, + right: 24, + top: 32, + bottom: 32 + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + label.isNotEmpty ? Text( - label, - style: TextStyle( - fontSize: 14, - color: PaletteDark.walletCardText - ), - ) + label, + style: TextStyle( + fontSize: 14, + color: PaletteDark.walletCardText + ), + ) : Offstage(), - Padding( - padding: label.isNotEmpty + Padding( + padding: label.isNotEmpty ? EdgeInsets.only(top: 10) : EdgeInsets.only(top: 0), - child: Text( - address, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Colors.white - ), - ), - ) - ]), - ), - ); - } - ); - } - ) - ), - ), - ) - ) - ], - ), + child: Text( + address, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Colors.white + ), + ), + ) + ]), + ), + ); + } + ); + } + ) + ), + ), + ], + ), + ) ); } } \ No newline at end of file diff --git a/lib/src/screens/receive/widgets/header_tile.dart b/lib/src/screens/receive/widgets/header_tile.dart index c5d23b0e5..74ab84e84 100644 --- a/lib/src/screens/receive/widgets/header_tile.dart +++ b/lib/src/screens/receive/widgets/header_tile.dart @@ -20,8 +20,8 @@ class HeaderTile extends StatelessWidget { padding: EdgeInsets.only( left: 24, right: 24, - top: 32, - bottom: 32 + top: 24, + bottom: 24 ), color: Colors.transparent, child: Row(