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

Envoy UI #213

Merged
merged 4 commits into from
May 17, 2023
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
14 changes: 12 additions & 2 deletions lib/ui/amount.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
// SPDX-License-Identifier: GPL-3.0-or-later

import 'dart:async';

import 'package:envoy/business/exchange_rate.dart';
import 'package:envoy/business/settings.dart';
import 'package:envoy/util/haptics.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart';
import 'package:wallet/wallet.dart';
import 'package:envoy/business/settings.dart';

import 'envoy_colors.dart';

Expand Down Expand Up @@ -85,6 +86,11 @@ class AmountEntryState extends State<AmountEntry> {
} else {
_enteredAmount = _enteredAmount + event;
}
//limit entered amount
if (amountSats >= 2.1e15) {
_enteredAmount =
_enteredAmount.substring(0, _enteredAmount.length - 1);
}
});
}
}
Expand Down Expand Up @@ -297,7 +303,11 @@ int convertSatsStringToSats(String amountSats) {
if (amountSats.isEmpty) {
return 0;
}
return int.parse(amountSats);
try {
return int.parse(amountSats);
} catch (e) {
return 0;
}
}

int convertBtcStringToSats(String amountBtc) {
Expand Down
39 changes: 33 additions & 6 deletions lib/ui/embedded_video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class EmbeddedVideoState extends State<EmbeddedVideo> {
Timer? _updatePositionTimer;
int _position = 0;
int _duration = 3;
bool _muted = false;

@override
void initState() {
Expand Down Expand Up @@ -58,12 +59,18 @@ class EmbeddedVideoState extends State<EmbeddedVideo> {
Widget build(BuildContext context) {
return Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: VlcPlayer(
controller: _videoPlayerController!,
aspectRatio: 4 / 3,
placeholder: Center(child: CircularProgressIndicator()),
Card(
elevation: 12,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: VlcPlayer(
controller: _videoPlayerController!,
aspectRatio: 4 / 3,
placeholder: Center(child: CircularProgressIndicator()),
),
),
),
Positioned.fill(
Expand All @@ -84,6 +91,26 @@ class EmbeddedVideoState extends State<EmbeddedVideo> {
),
),
),
Align(
child: Material(
color: Colors.transparent,
child: IconButton(
color: Colors.white,
icon: Icon(_muted ? Icons.volume_off_sharp : Icons.volume_up),
onPressed: () async {
setState(() {
_muted = !_muted;
if (_muted) {
_videoPlayerController?.setVolume(0);
} else {
_videoPlayerController?.setVolume(100);
}
});
},
),
),
alignment: Alignment.topRight,
)
],
);
}
Expand Down
7 changes: 6 additions & 1 deletion lib/ui/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class _HomePageState extends ConsumerState<HomePage>
if (onboarded != true) {
Navigator.pushNamed(context, "/splash");
}
//Sets default home card
_navigateToCard(1);
});
// Home is there for the lifetime of the app so no need to dispose stream
ConnectivityManager().events.stream.listen((event) {
Expand Down Expand Up @@ -279,7 +281,10 @@ class _HomePageState extends ConsumerState<HomePage>
_leftAction?.call();
return false;
} else {
if (_tabController.index != 1) {
if (_leftAction != null && _leftAction != _toggleSettings) {
_leftAction?.call();
return false;
} else if (_tabController.index != 1) {
_tabController.animateTo(1);
return false;
}
Expand Down
Loading