Skip to content

Commit

Permalink
solved for #113
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmeta committed Jan 6, 2022
1 parent 38f1035 commit 549fe30
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 31 deletions.
14 changes: 13 additions & 1 deletion raven_front/lib/backdrop/src/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';

import 'package:raven_back/streams/streams.dart';

/// [InheritedWidget] that exposes state of [BackdropScaffold].
///
/// [Backdrop.of] can be used to access [BackdropScaffoldState] from anywhere
Expand Down Expand Up @@ -573,7 +575,7 @@ class BackdropScaffoldState extends State<BackdropScaffold>
Flexible(child: widget.frontLayer),
],
),
_buildInactiveLayer(context),
if (_hasFrontLayerScrim) _buildInactiveLayer(context),
],
),
),
Expand Down Expand Up @@ -657,6 +659,16 @@ class BackdropScaffoldState extends State<BackdropScaffold>
bool get _hasBackLayerScrim =>
isBackLayerConcealed && widget.frontLayerActiveFactor < 1;

/// this is not an ideal solution to
/// https://github.com/fluttercommunity/backdrop/issues/117
/// because I don't want the backdrop layer to have access to the streams
/// I'd rather the widget inform the backdrop layer how to behave
/// However, I tried making the `Offstage` in `_buildInactiveLayer` work
/// according to a widget variable which was modified in realtime by
/// `.revealBackLayer(activeFront: true);` but that failed to work, so
/// though this is not the pure top-down solution I was hoping for, it works:
bool get _hasFrontLayerScrim => streams.app.page.value == 'Wallet';

@override
Widget build(BuildContext context) {
return Backdrop(
Expand Down
5 changes: 3 additions & 2 deletions raven_front/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class RavenMobileApp extends StatelessWidget {
},
builder: (context, child) {
return BackdropScaffold(
headerHeight: 430,
//headerHeight: components.size.height, // use stickyFrontLayer instead
stickyFrontLayer: true,
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
backLayerBackgroundColor: Theme.of(context).backgroundColor,
Expand Down Expand Up @@ -128,7 +129,7 @@ class RavenMobileApp extends StatelessWidget {
SizedBox(width: 16),
],
),
backLayer: NavDrawer(),
backLayer: BackLayer(),
frontLayer: Container(color: Colors.white, child: child!),
floatingActionButton: NavBar(),
floatingActionButtonLocation:
Expand Down
44 changes: 20 additions & 24 deletions raven_front/lib/pages/transaction/send.dart
Original file line number Diff line number Diff line change
Expand Up @@ -659,30 +659,26 @@ class _SendState extends State<Send> {
onPressed: () async => await startSend(),
style: components.buttonStyles.curvedSides);

Widget sendTransactionButton() => Expanded(
child: Container(
width: MediaQuery.of(context).size.width,
height: 40,
child: OutlinedButton.icon(
onPressed: () async => await startSend(),
icon: Image(
image: AssetImage('assets/icons/send/send_black.png'),
height: 24,
width: 24),
label: Text('SEND'.toUpperCase()),
style: ButtonStyle(
//fixedSize: MaterialStateProperty.all(Size(156, 40)),
textStyle:
MaterialStateProperty.all(Theme.of(context).navBarButton),
foregroundColor: MaterialStateProperty.all(Color(0xDE000000)),
side: MaterialStateProperty.all(BorderSide(
color: Color(0xFF5C6BC0),
width: 2,
style: BorderStyle.solid)),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0))),
),
)));
Widget sendTransactionButton() => Container(
width: MediaQuery.of(context).size.width,
height: 40,
child: OutlinedButton.icon(
onPressed: () async => await startSend(),
icon: Image(
image: AssetImage('assets/icons/send/send_black.png'),
height: 24,
width: 24),
label: Text('SEND'.toUpperCase()),
style: ButtonStyle(
//fixedSize: MaterialStateProperty.all(Size(156, 40)),
textStyle: MaterialStateProperty.all(Theme.of(context).navBarButton),
foregroundColor: MaterialStateProperty.all(Color(0xDE000000)),
side: MaterialStateProperty.all(BorderSide(
color: Color(0xFF5C6BC0), width: 2, style: BorderStyle.solid)),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0))),
),
));

Future confirmMessage({
required ravencoin.Transaction tx,
Expand Down
39 changes: 39 additions & 0 deletions raven_front/lib/theme/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,43 @@ extension TextStyleExtension on ThemeData {
fontWeight: FontWeightNames.semiBold,
letterSpacing: 0.15,
color: Color(0x99000000));
TextStyle? get balanceAmount => this.brightness == Brightness.light
? TextStyle(
fontSize: 24.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.18,
color: Colors.white)
: TextStyle(
fontSize: 24.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.18,
color: Colors.white);
TextStyle? get balanceDollar => this.brightness == Brightness.light
? TextStyle(
fontSize: 16.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.5,
color: Colors.white)
: TextStyle(
fontSize: 16.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.5,
color: Colors.white);
TextStyle? get remaining => this.brightness == Brightness.light
? TextStyle(
fontSize: 14.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.25,
color: Color(0xDEFFFFFF))
: TextStyle(
fontSize: 14.0,
fontFamily: 'Nunito',
fontWeight: FontWeightNames.regular,
letterSpacing: 0.25,
color: Color(0xDEFFFFFF));
}
49 changes: 49 additions & 0 deletions raven_front/lib/widgets/back_layer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:raven_back/raven_back.dart';
import 'package:raven_back/streams/streams.dart';
import 'package:raven_front/widgets/widgets.dart';

class BackLayer extends StatefulWidget {
BackLayer({Key? key}) : super(key: key);

@override
_BackLayerState createState() => _BackLayerState();
}

class _BackLayerState extends State<BackLayer> {
late String pageTitle = 'Wallet';
late List listeners = [];

@override
void initState() {
super.initState();
listeners.add(streams.app.page.stream.listen((value) {
if (value != pageTitle) {
setState(() {
pageTitle = value;
});
}
}));
}

@override
void dispose() {
for (var listener in listeners) {
listener.cancel();
}
super.dispose();
}

@override
Widget build(BuildContext context) {
if (pageTitle.startsWith('Wallet')) {
return NavDrawer();
} else if (pageTitle == 'Send') {
return BalanceHeader();
}
return Container(
height: 0,
width: 0,
);
}
}
60 changes: 60 additions & 0 deletions raven_front/lib/widgets/balance_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
import 'package:raven_front/backdrop/backdrop.dart';
import 'package:raven_front/components/components.dart';
import 'package:raven_front/theme/extensions.dart';

class BalanceHeader extends StatefulWidget {
BalanceHeader({Key? key}) : super(key: key);

@override
_BalanceHeaderState createState() => _BalanceHeaderState();
}

class _BalanceHeaderState extends State<BalanceHeader> {
List listeners = [];

@override
void initState() {
super.initState();
Backdrop.of(components.navigator.routeContext!).revealBackLayer();
}

@override
void dispose() {
for (var listener in listeners) {
listener.cancel();
}
super.dispose();
}

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(16),
child: ListView(
shrinkWrap: true,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/rvnonly.png',
height: 56,
width: 56,
),
SizedBox(height: 8),
Text('amount', style: Theme.of(context).balanceAmount),
SizedBox(height: 1),
Text('dollars', style: Theme.of(context).balanceDollar),
SizedBox(height: 30),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Text('Remaining:', style: Theme.of(context).remaining),
Text('amount', style: Theme.of(context).remaining)
]),
],
)
],
),
);
}
}
13 changes: 10 additions & 3 deletions raven_front/lib/widgets/nav_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@ class _NavDrawerState extends State<NavDrawer> {

@override
Widget build(BuildContext context) {
return Padding(
return Container(
padding: EdgeInsets.only(left: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

/// using a listview makes it variable so you don't have to define height
//height: 300,
//child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
///
child: ListView(
shrinkWrap: true,
children: [
destination(
image: Image(
Expand Down
6 changes: 5 additions & 1 deletion raven_front/lib/widgets/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ export 'connection.dart';
export 'lead.dart';
export 'title.dart';

// body
// back layer
export 'back_layer.dart';
export 'nav_drawer.dart';
export 'balance_header.dart';

// floating action button
export 'nav_bar.dart';

// lists
Expand Down

0 comments on commit 549fe30

Please sign in to comment.