Skip to content

Commit

Permalink
Merge pull request #5 from archethic-foundation/web_messagechannel_rpc
Browse files Browse the repository at this point in the history
⬆️ Use AWC with Web MessageChannel RPC
  • Loading branch information
redDwarf03 authored Apr 3, 2024
2 parents 029b780 + c5ec940 commit 95bf740
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 158 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
Changelog
=========
#### Version 1.0.0
* Stable version

#### Version 0.0.9
* Fix responsive
* Fix popup navigation

#### Version 0.0.8
* Upgrade dependencies

#### Version 0.0.7
* Upgrade dependencies

#### Version 0.0.6
* Upgrade dependencies

#### Version 0.0.5
* Get Verified tokens from blockchain

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Archethic's flutter framework to create Archethic Dapps
WIP
This project provides widgets to facilitate the creation of Archethic DApps

## Arb file management

Expand Down
6 changes: 1 addition & 5 deletions lib/src/ui/util/components/archethic_oracle_uco.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'package:archethic_dapp_framework_flutter/src/application/oracle/provider.dart';
import 'package:archethic_dapp_framework_flutter/src/ui/util/components/icon_button_animated.dart';
import 'package:archethic_dapp_framework_flutter/src/ui/util/generic/formatters.dart';
import 'package:archethic_dapp_framework_flutter/src/ui/util/generic/responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intl/intl.dart';
Expand Down Expand Up @@ -49,10 +48,7 @@ class ArchethicOracleUco extends ConsumerWidget {
SelectableText(
'1 UCO = \$${archethicOracleUCO.usd.formatNumber(precision: 2)} ($timestamp)',
style: TextStyle(
fontSize: Responsive.fontSizeFromTextStyle(
context,
Theme.of(context).textTheme.labelSmall!,
),
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
),
),
],
Expand Down
2 changes: 2 additions & 0 deletions lib/src/ui/util/components/buttons/app_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class AppButtonState extends State<AppButton> {
fontSize: Responsive.fontSizeFromValue(
context,
desktopValue: widget.fontSize,
ratioTablet: 1,
ratioMobile: 1,
),
fontWeight: FontWeight.w400,
),
Expand Down
12 changes: 7 additions & 5 deletions lib/src/ui/util/components/buttons/popup_close_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class PopupCloseButton extends StatelessWidget {
this.warningCloseLabel = '',
this.warningCloseFunction,
this.warningCloseWarning = false,
this.closeFunction,
});

final bool warningCloseWarning;
final String warningCloseLabel;
final Function? warningCloseFunction;
final Function? closeFunction;

@override
Widget build(BuildContext context) {
Expand All @@ -25,11 +27,12 @@ class PopupCloseButton extends StatelessWidget {
child: InkWell(
onTap: () async {
if (warningCloseWarning == false) {
if (warningCloseFunction != null) {
await warningCloseFunction!();
if (closeFunction != null) {
await closeFunction!();
} else {
if (!context.mounted) return;
Navigator.of(context).pop();
}
if (!context.mounted) return;
Navigator.of(context).pop();
return;
}

Expand Down Expand Up @@ -109,7 +112,6 @@ class PopupCloseButton extends StatelessWidget {

if (!context.mounted) return;
Navigator.of(context).pop();
Navigator.of(context).pop();
},
),
],
Expand Down
8 changes: 6 additions & 2 deletions lib/src/ui/util/components/in_progress/in_progress_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ class InProgressPopup {
BuildContext context,
List<Widget> Function(BuildContext context, WidgetRef ref) bodyBuilder,
PopupCloseButton Function(BuildContext context, WidgetRef ref)
closeButtonBuilder,
) async {
closeButtonBuilder, {
bool useSafeArea = false,
bool useRootNavigator = false,
}) async {
return showDialog<void>(
context: context,
useSafeArea: useSafeArea,
useRootNavigator: useRootNavigator,
builder: (context) {
return ScaffoldMessenger(
child: Builder(
Expand Down
154 changes: 61 additions & 93 deletions lib/src/ui/util/components/info_banner.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:archethic_dapp_framework_flutter/src/ui/themes/app_theme_base.dart';
import 'package:archethic_dapp_framework_flutter/src/ui/util/generic/responsive.dart';
import 'package:archethic_dapp_framework_flutter/src/ui/util/iconsax.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
Expand All @@ -10,121 +11,88 @@ class InfoBanner extends StatelessWidget {
const InfoBanner(
this.message,
this.infoBannerType, {
this.height = 40,
this.width = AppThemeBase.sizeBoxComponentWidth,
this.waitAnimation = false,
super.key,
});

final String message;
final InfoBannerType infoBannerType;
final double height;
final double width;
final bool waitAnimation;

@override
Widget build(BuildContext context) {
if (message.isEmpty) {
return SizedBox(
height: height,
);
return const SizedBox.shrink(); //
}

return SizedBox(
width: width,
height: height,
return Container(
padding: const EdgeInsets.only(
left: 10,
right: 10,
top: 5,
bottom: 5,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
10,
),
border: Border.all(
color: infoBannerType == InfoBannerType.error
? Theme.of(context).colorScheme.error.withOpacity(0.6)
: infoBannerType == InfoBannerType.request
? Theme.of(context).colorScheme.primary.withOpacity(0.6)
: AppThemeBase.statusOK.withOpacity(0.6),
width: 0.5,
),
gradient: AppThemeBase.gradientInfoBannerBackground,
),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (infoBannerType == InfoBannerType.error)
Icon(
Iconsax.warning_2,
color: Theme.of(context).colorScheme.error,
size: Responsive.fontSizeFromTextStyle(
context,
Theme.of(context).textTheme.bodyMedium!,
) +
2,
),
if (infoBannerType == InfoBannerType.error) const SizedBox(width: 5),
Expanded(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Expanded(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
10,
),
border: Border.all(
color: infoBannerType == InfoBannerType.error
? Theme.of(context)
.colorScheme
.error
.withOpacity(0.6)
: infoBannerType == InfoBannerType.request
? Theme.of(context)
.colorScheme
.primary
.withOpacity(0.6)
: AppThemeBase.statusOK.withOpacity(0.6),
width: 0.5,
),
gradient: AppThemeBase.gradientInfoBannerBackground,
child: SelectableText(
message,
style: TextStyle(
color: infoBannerType == InfoBannerType.error
? Theme.of(context).colorScheme.error
: infoBannerType == InfoBannerType.request
? Theme.of(context).colorScheme.primary
: AppThemeBase.statusOK,
fontSize: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
fontSize: Responsive.fontSizeFromTextStyle(
context,
Theme.of(context).textTheme.bodyMedium!,
),
child: Container(
padding: const EdgeInsets.only(
left: 10,
),
height: 45,
alignment: Alignment.centerLeft,
child: Row(
children: [
if (infoBannerType == InfoBannerType.error)
Icon(
Iconsax.warning_2,
color: Theme.of(context).colorScheme.error,
),
if (infoBannerType == InfoBannerType.error)
const SizedBox(width: 5),
Expanded(
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Padding(
padding:
const EdgeInsets.only(top: 2, right: 5),
child: SelectableText(
message,
style: TextStyle(
color: infoBannerType ==
InfoBannerType.error
? Theme.of(context)
.colorScheme
.error
: infoBannerType ==
InfoBannerType.request
? Theme.of(context)
.colorScheme
.primary
: AppThemeBase.statusOK,
),
),
),
if (waitAnimation)
SizedBox(
width: 10,
height: 10,
child: CircularProgressIndicator(
color: Colors.white.withOpacity(0.6),
strokeWidth: 1,
),
),
],
),
),
],
),
),
),
),
],
)
.fontSize,
),
),
),
if (waitAnimation)
SizedBox(
width: 10,
height: 10,
child: CircularProgressIndicator(
color: Colors.white.withOpacity(0.6),
strokeWidth: 1,
),
),
],
),
)
Expand Down
6 changes: 4 additions & 2 deletions lib/src/ui/util/generic/responsive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ class Responsive extends StatelessWidget {
static double fontSizeFromValue(
BuildContext context, {
required double desktopValue,
double ratioTablet = 2,
double ratioMobile = 4,
}) {
if (Responsive.isDesktop(context)) {
return desktopValue;
} else {
if (Responsive.isTablet(context)) {
return desktopValue - 2;
return desktopValue - ratioTablet;
}
}
return desktopValue - 4;
return desktopValue - ratioMobile;
}

@override
Expand Down
Loading

0 comments on commit 95bf740

Please sign in to comment.