parent
12621e42ac
commit
5024fe2f21
|
|
@ -9,6 +9,8 @@ class DialogService {
|
||||||
Function(DialogRequest) _showDialogInputListener;
|
Function(DialogRequest) _showDialogInputListener;
|
||||||
Completer<DialogResponse> _dialogCompleter;
|
Completer<DialogResponse> _dialogCompleter;
|
||||||
|
|
||||||
|
Completer<DialogResponse> get completer => this._dialogCompleter;
|
||||||
|
|
||||||
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
|
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
|
||||||
|
|
||||||
/// Registers a callback function. Typically to show the dialog
|
/// Registers a callback function. Typically to show the dialog
|
||||||
|
|
@ -67,4 +69,6 @@ class DialogService {
|
||||||
_dialogCompleter.complete(response);
|
_dialogCompleter.complete(response);
|
||||||
_dialogCompleter = null;
|
_dialogCompleter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,11 +212,10 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
padding: const EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0),
|
||||||
child: StoreConnector<AppState, SettingState>(
|
child: StoreConnector<AppState, SettingState>(
|
||||||
converter: (store) => store.state.settingState,
|
converter: (store) => store.state.settingState,
|
||||||
builder: (context, vm) {
|
builder: (context, vm) {
|
||||||
|
|
@ -358,21 +357,29 @@ class _AdditionalTabState extends State<AdditionalTab> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
verticalSpaceMedium,
|
verticalSpaceMedium,
|
||||||
Row(
|
Container(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
margin: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
children: <Widget>[
|
child: Row(
|
||||||
BusyButton(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
title: 'Взнос наличных',
|
children: <Widget>[
|
||||||
onPressed: _deposit,
|
Expanded(
|
||||||
busy: depositBusy,
|
child: BusyButton(
|
||||||
),
|
title: 'Взнос наличных',
|
||||||
BusyButton(
|
onPressed: _deposit,
|
||||||
title: 'Снятие наличных',
|
busy: depositBusy,
|
||||||
onPressed: _withdrawal,
|
),
|
||||||
mainColor: redColor,
|
),
|
||||||
busy: withdrawalBusy,
|
horizontalSpaceSmall,
|
||||||
),
|
Expanded(
|
||||||
],
|
child: BusyButton(
|
||||||
|
title: 'Снятие наличных',
|
||||||
|
onPressed: _withdrawal,
|
||||||
|
mainColor: redColor,
|
||||||
|
busy: withdrawalBusy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class DialogManager extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DialogManagerState extends State<DialogManager> {
|
class _DialogManagerState extends State<DialogManager> {
|
||||||
DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
TextEditingController controller;
|
TextEditingController controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -78,7 +78,7 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
void _showDialogInput(DialogRequest request) {
|
void _showDialogInput(DialogRequest request) {
|
||||||
var isConfirmationDialog = request.cancelTitle != null;
|
var isConfirmationDialog = request.cancelTitle != null;
|
||||||
controller.clear();
|
controller.clear();
|
||||||
showDialog(
|
var dialogController = showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|
@ -143,5 +143,11 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
dialogController.whenComplete(() {
|
||||||
|
//hook when press overlay and response not completed
|
||||||
|
if (_dialogService.completer != null) {
|
||||||
|
_dialogService.completer.complete(DialogResponse(confirmed: false));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// A button that shows a busy indicator in place of title
|
/// A button that shows a busy indicator in place of title
|
||||||
|
|
@ -52,7 +53,7 @@ class _AmanIconButtonState extends State<AmanIconButton> {
|
||||||
: CircularProgressIndicator(
|
: CircularProgressIndicator(
|
||||||
strokeWidth: 3,
|
strokeWidth: 3,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(widget.mainColor))),
|
valueColor: AlwaysStoppedAnimation<Color>(widget.mainColor))),
|
||||||
Text(widget.title, overflow: TextOverflow.fade, maxLines: 2, style: TextStyle(color: widget.mainColor, fontSize: 14, fontWeight: FontWeight.w800, ), textAlign: TextAlign.center,)
|
AutoSizeText(widget.title, overflow: TextOverflow.fade, maxLines: 2, style: TextStyle(color: widget.mainColor, fontSize: 14, fontWeight: FontWeight.w800, ), textAlign: TextAlign.center,)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// A button that shows a busy indicator in place of title
|
/// A button that shows a busy indicator in place of title
|
||||||
|
|
@ -36,7 +37,7 @@ class _AmanIconButtonHorizontalState extends State<AmanIconButtonHorizontal> {
|
||||||
color: widget.selected
|
color: widget.selected
|
||||||
? widget.activeColor
|
? widget.activeColor
|
||||||
: widget.inactiveColor),
|
: widget.inactiveColor),
|
||||||
Text(widget.title,
|
AutoSizeText(widget.title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.selected
|
color: widget.selected
|
||||||
? widget.activeColor
|
? widget.activeColor
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class BusyButton extends StatefulWidget {
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
final Color mainColor;
|
final Color mainColor;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
||||||
const BusyButton(
|
const BusyButton(
|
||||||
{@required this.title,
|
{@required this.title,
|
||||||
this.busy = false,
|
this.busy = false,
|
||||||
|
|
@ -50,19 +51,27 @@ class _BusyButtonState extends State<BusyButton> {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
widget.icon != null
|
|
||||||
? Container(
|
|
||||||
child: (Icon(
|
|
||||||
widget.icon,
|
|
||||||
color: whiteColor,
|
|
||||||
)),
|
|
||||||
margin: const EdgeInsets.only(right: 10.0),
|
|
||||||
)
|
|
||||||
: (Container()),
|
|
||||||
!widget.busy
|
!widget.busy
|
||||||
? AutoSizeText(
|
? Expanded(
|
||||||
widget.title,
|
child: Row(
|
||||||
style: buttonTitleTextStyle,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
widget.icon != null
|
||||||
|
? Container(
|
||||||
|
child: (Icon(
|
||||||
|
widget.icon,
|
||||||
|
color: whiteColor,
|
||||||
|
)),
|
||||||
|
margin: const EdgeInsets.only(right: 10.0),
|
||||||
|
)
|
||||||
|
: (Container()),
|
||||||
|
AutoSizeText(
|
||||||
|
widget.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: buttonTitleTextStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: CircularProgressIndicator(
|
: CircularProgressIndicator(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
|
|
|
||||||
22
pubspec.lock
22
pubspec.lock
|
|
@ -141,7 +141,7 @@ packages:
|
||||||
name: get_it
|
name: get_it
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "4.0.2"
|
||||||
google_fonts:
|
google_fonts:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -184,6 +184,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.1"
|
version: "0.9.1"
|
||||||
|
mask_text_input_formatter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: mask_text_input_formatter
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.7"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -302,7 +309,7 @@ packages:
|
||||||
name: provider
|
name: provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.3"
|
version: "4.3.0"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -365,7 +372,7 @@ packages:
|
||||||
name: responsive_builder
|
name: responsive_builder
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.9"
|
version: "0.2.0+2"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -475,7 +482,14 @@ packages:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.4.11"
|
version: "5.5.0"
|
||||||
|
url_launcher_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+1"
|
||||||
url_launcher_macos:
|
url_launcher_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
17
pubspec.yaml
17
pubspec.yaml
|
|
@ -6,20 +6,20 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
cupertino_icons: ^0.1.2
|
cupertino_icons: ^0.1.3
|
||||||
redux: ^4.0.0
|
redux: ^4.0.0
|
||||||
flutter_redux: ^0.6.0
|
flutter_redux: ^0.6.0
|
||||||
redux_thunk: ^0.3.0
|
redux_thunk: ^0.3.0
|
||||||
redux_persist: ^0.8.4
|
redux_persist: ^0.8.4
|
||||||
redux_persist_flutter: ^0.8.2
|
redux_persist_flutter: ^0.8.2
|
||||||
responsive_builder: ^0.1.4
|
responsive_builder: ^0.2.0+2
|
||||||
provider: ^4.1.2
|
provider: ^4.3.0
|
||||||
logger: ^0.9.1
|
logger: ^0.9.1
|
||||||
get_it: ^3.0.3
|
get_it: ^4.0.2
|
||||||
equatable: ^1.1.1
|
equatable: ^1.2.0
|
||||||
http: ^0.12.1
|
http: ^0.12.1
|
||||||
sqflite: ^1.3.0
|
sqflite: ^1.3.1
|
||||||
path_provider: ^1.6.9
|
path_provider: ^1.6.11
|
||||||
google_fonts: ^1.1.0
|
google_fonts: ^1.1.0
|
||||||
material_design_icons_flutter: ^4.0.5345
|
material_design_icons_flutter: ^4.0.5345
|
||||||
intl: ^0.16.1
|
intl: ^0.16.1
|
||||||
|
|
@ -27,8 +27,9 @@ dependencies:
|
||||||
device_info: ^0.4.2+4
|
device_info: ^0.4.2+4
|
||||||
esys_flutter_share: ^1.0.2
|
esys_flutter_share: ^1.0.2
|
||||||
auto_size_text: ^2.1.0
|
auto_size_text: ^2.1.0
|
||||||
url_launcher: ^5.4.11
|
url_launcher: ^5.5.0
|
||||||
qr_flutter: ^3.2.0
|
qr_flutter: ^3.2.0
|
||||||
|
mask_text_input_formatter: ^1.0.7
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue