Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoice actions #125

Merged
merged 7 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/routes/user/home/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:breez/bloc/invoice/invoice_bloc.dart';
import 'package:breez/bloc/user_profile/currency.dart';
import 'package:breez/bloc/user_profile/user_profile_bloc.dart';
import 'package:breez/routes/user/home/floating_actions_bar.dart';
import 'package:breez/routes/user/home/invoice_bottom_sheet.dart';
import 'package:breez/routes/user/home/payments_filter.dart';
import 'package:breez/routes/user/home/payments_list.dart';
import 'package:breez/routes/user/home/wallet_dashboard.dart';
Expand Down Expand Up @@ -164,6 +165,13 @@ class AccountPageState extends State<AccountPage> with SingleTickerProviderState
return account != null && !account.initial ? FloatingActionsBar(account, height, heightFactor) : Positioned(top: 0.0, child: SizedBox());
},
),
ScrollWatcher(
controller: widget.scrollController,
builder: (context, offset) {
double height = (DASHBOARD_MAX_HEIGHT - offset).clamp(DASHBOARD_MIN_HEIGHT, DASHBOARD_MAX_HEIGHT);
return (account?.active ?? false) ? InvoiceBottomSheet(_invoiceBloc, height < 160.0) : Positioned(top: 0.0, child: SizedBox());
},
),
],
);
}
Expand Down
87 changes: 87 additions & 0 deletions lib/routes/user/home/invoice_bottom_sheet.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:breez/bloc/invoice/invoice_bloc.dart';
import 'package:breez/theme_data.dart' as theme;
import 'package:flutter/material.dart';

class InvoiceBottomSheet extends StatefulWidget {
final InvoiceBloc invoiceBloc;
final bool isSmallView;

InvoiceBottomSheet(this.invoiceBloc, this.isSmallView);

@override
State createState() => InvoiceBottomSheetState();
}

class InvoiceBottomSheetState extends State<InvoiceBottomSheet> with TickerProviderStateMixin {
bool isExpanded;

@override
void initState() {
super.initState();
isExpanded = false;
}

@override
Widget build(BuildContext context) {
return AnimatedContainer(
transform: isExpanded ? Matrix4.translationValues(0, 0, 0) : Matrix4.translationValues(0, 112.0, 0),
duration: Duration(milliseconds: 150),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
_buildInvoiceMenuItem("INVOICE", "src/icon/invoice.png", () {
setState(() {
isExpanded = !isExpanded;
});
}, isFirst: true),
_buildInvoiceMenuItem("PAY", "src/icon/qr_scan.png", () async {
String decodedQr = await BarcodeScanner.scan();
widget.invoiceBloc.decodeInvoiceSink.add(decodedQr);
}),
_buildInvoiceMenuItem("CREATE", "src/icon/paste.png", () => Navigator.of(context).pushNamed('/create_invoice')),
]));
}

Widget _buildInvoiceMenuItem(String title, String iconPath, Function function, {bool isFirst = false}) {
return AnimatedContainer(
width: widget.isSmallView ? 56.0 : 126.0,
height: isFirst ? 50.0 : 56.0,
duration: Duration(milliseconds: 150),
child: RaisedButton(
onPressed: function,
color: isFirst ? Colors.white : Color.fromRGBO(0, 133, 251, 1.0),
padding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 12.0),
shape: isFirst
? RoundedRectangleBorder(borderRadius: new BorderRadius.only(topLeft: Radius.circular(20.0)))
: Border(top: BorderSide(color: Color.fromRGBO(255, 255, 255, 0.12), width: 1, style: BorderStyle.solid)),
child: Row(
mainAxisSize: MainAxisSize.max,
children: widget.isSmallView
? <Widget>[
ImageIcon(
AssetImage(iconPath),
color: isFirst ? Color.fromRGBO(0, 133, 251, 1.0) : Colors.white,
size: 24.0,
)
]
: <Widget>[
ImageIcon(
AssetImage(iconPath),
color: isFirst ? Color.fromRGBO(0, 133, 251, 1.0) : Colors.white,
size: 24.0,
),
Padding(padding: EdgeInsets.only(left: 8.0)),
Text(
title.toUpperCase(),
style: theme.bottomSheetMenuItemStyle.copyWith(
color: isFirst ? Color.fromRGBO(0, 133, 251, 1.0) : Colors.white,
),
),
]),
),
);
}
}
1 change: 1 addition & 0 deletions lib/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ final TextStyle notificationTextStyle = new TextStyle(color: BreezColors.grey[50
final TextStyle headline = new TextStyle(color: BreezColors.grey[600],fontSize: 26.0);
final TextStyle subtitle = new TextStyle(color: BreezColors.grey[600],fontSize: 14.3,letterSpacing: 0.2);
final TextStyle addFundsBtnStyle = new TextStyle(color: BreezColors.white[400], fontSize: 16.0, letterSpacing: 1.25);
final TextStyle bottomSheetMenuItemStyle = new TextStyle(color: BreezColors.white[400], fontSize: 14.3, letterSpacing: 0.55);
final TextStyle autoCompleteStyle = new TextStyle(color: Colors.black, fontSize: 14.0);
final TextStyle dialogBlackStye = TextStyle(color: Colors.black, fontSize: 16.0, height: 1.5);
final TextStyle dialogGrayStyle = TextStyle(color: BreezColors.grey[500], fontSize: 16.0, height: 1.5);
Expand Down
Binary file added src/icon/invoice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.