Skip to content

Commit

Permalink
Added the pylons loading animation (#1725)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjawadDeveloper2 committed Dec 22, 2022
1 parent b248b05 commit e3c9e92
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 24 deletions.
3 changes: 2 additions & 1 deletion dart_sdk/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ linter:
- unrelated_type_equality_checks
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps
- valid_regexps
- sort_pub_dependencies
Binary file added dart_sdk/assets/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions dart_sdk/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ class _MyHomePageState extends State<MyHomePage> {
},
child: const Text('Show Stripe'),
),
ElevatedButton(
onPressed: () async {
_showLoader();
},
child: const Text('Show Loader'),
),
],
),
),
Expand Down Expand Up @@ -398,4 +404,12 @@ class _MyHomePageState extends State<MyHomePage> {
void showStripe() {
PylonsWallet.instance.showStripe();
}

void _showLoader() async {
PylonsLoadingAnimation animation = PylonsLoadingAnimation(context: context, height: 100, width: 100);
animation.show();

await Future.delayed(const Duration(seconds: 5));
animation.hide();
}
}
1 change: 1 addition & 0 deletions dart_sdk/lib/low_level.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export 'src/generated/pylons/tx.pb.dart';
export 'src/features/models/sdk_ipc_response.dart';
export 'src/features/data/models/profile.dart' show Profile;
export 'src/features/helper/dec_string.dart';
export 'src/ui/pylons_loading_animation.dart';
1 change: 1 addition & 0 deletions dart_sdk/lib/pylons_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export 'src/types/item.dart';
export 'src/types/profile.dart';
export 'src/types/recipe.dart';
export 'src/features/helper/dec_string.dart';
export 'src/ui/pylons_loading_animation.dart';
34 changes: 34 additions & 0 deletions dart_sdk/lib/src/ui/pylons_loading_animation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';

class PylonsLoadingAnimation {
PylonsLoadingAnimation({
required this.context,
double height = 100,
double width = 100,
}) : _height = height,
_width = width;

Future show() {
return showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.white.withOpacity(0),
builder: (ctx) => WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
elevation: 0,
backgroundColor: Colors.transparent,
content: SizedBox(height: _height, width: _width, child: Image.asset('assets/loading.gif', package: 'pylons_sdk',)),
),
),
);
}

void hide() {
Navigator.of(context).pop();
}

final BuildContext context;
final double _height;
final double _width;
}
34 changes: 11 additions & 23 deletions dart_sdk/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,24 @@ environment:
sdk: ">=2.14.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

dartz: ^0.10.0
equatable: ^2.0.3
decimal: ^2.1.0

#Used it for ipc
equatable: ^2.0.3
fixnum: ^1.0.0
flutter:
sdk: flutter
http: ^0.13.5
protobuf: ^2.0.0
uni_links: ^0.5.1
uni_links_platform_interface: ^1.0.0


url_launcher: ^6.1.2
protobuf: ^2.0.0

fixnum: ^1.0.0
http: ^0.13.5

bitstream: ">=0.0.4 <2.0.0"


dev_dependencies:
build_runner: ^2.1.4
flutter_test:
sdk: flutter

mockito: ^5.0.16

# code_builder: ^4.0.0
build_runner: ^2.1.4





flutter:
assets:
- assets/loading.gif

0 comments on commit e3c9e92

Please sign in to comment.