-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into deriv_logger/add_network_logs
- Loading branch information
Showing
26 changed files
with
867 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: deriv_auth | ||
description: Provides deriv authentication functionalities for dart/flutter apps. | ||
version: 6.7.17 | ||
version: 6.7.18 | ||
|
||
environment: | ||
sdk: ">=3.0.0 <4.0.0" | ||
|
@@ -51,13 +51,13 @@ dependencies: | |
git: | ||
url: [email protected]:regentmarkets/flutter-deriv-packages.git | ||
path: packages/deriv_localizations | ||
ref: deriv_localizations-v1.5.1 | ||
ref: deriv_localizations-v1.5.2 | ||
|
||
deriv_passkeys: | ||
git: | ||
url: [email protected]:regentmarkets/flutter-deriv-packages.git | ||
path: packages/deriv_passkeys | ||
ref: deriv_passkeys-v0.0.3+5 | ||
ref: deriv_passkeys-v0.0.3+6 | ||
|
||
deriv_language_selector: | ||
git: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/deriv_mobile_chart_wrapper/assets/icons/ic_indicators_empty_state.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/deriv_mobile_chart_wrapper/lib/src/core_widgets/chips_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:deriv_theme/deriv_theme.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'custom_chip.dart'; | ||
|
||
/// A widget to show a list of `CustomChip` widgets. | ||
class ChipsList extends StatelessWidget { | ||
/// Constructor of the widget | ||
const ChipsList({ | ||
required this.items, | ||
this.isHorizontalPaddingEnabled = false, | ||
double? horizontalPadding, | ||
Key? key, | ||
}) : horizontalPadding = isHorizontalPaddingEnabled | ||
? (horizontalPadding ?? ThemeProvider.margin16) | ||
: ThemeProvider.zeroMargin, | ||
super(key: key); | ||
|
||
/// The list of the items. | ||
final List<CustomChip> items; | ||
|
||
/// If true enable a padding at the start and end of the list. | ||
/// Default value is false. | ||
final bool isHorizontalPaddingEnabled; | ||
|
||
/// The padding value for the horizontal padding. | ||
/// If [isHorizontalPaddingEnabled] is true and [horizontalPadding] is null | ||
/// then [ThemeProvider.margin16] will be used as default value. | ||
/// Otherwise [ThemeProvider.zeroMargin] will be used as default value. | ||
final double horizontalPadding; | ||
|
||
@override | ||
Widget build(BuildContext context) => SizedBox( | ||
height: ThemeProvider.margin36, | ||
child: ListView.builder( | ||
padding: EdgeInsets.symmetric(horizontal: horizontalPadding), | ||
scrollDirection: Axis.horizontal, | ||
itemCount: items.length, | ||
itemBuilder: (_, int index) => Padding( | ||
padding: const EdgeInsets.only( | ||
left: ThemeProvider.zeroMargin, right: ThemeProvider.margin08), | ||
child: items[index], | ||
), | ||
), | ||
); | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/deriv_mobile_chart_wrapper/lib/src/core_widgets/core_widgets.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'custom_chip.dart'; | ||
export 'chips_list.dart'; |
93 changes: 93 additions & 0 deletions
93
packages/deriv_mobile_chart_wrapper/lib/src/core_widgets/custom_chip.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:deriv_theme/deriv_theme.dart'; | ||
|
||
/// The type of function to be passed to [CustomChip]'s `onTap` property. | ||
typedef OnTapCustomChip<T> = void Function(T? value, String? title); | ||
|
||
/// Will be called to get the content that needs to be shown inside chips. | ||
typedef LabelBuilder<T> = String Function(T? value, String? title); | ||
|
||
/// Will be called to get the content that needs to be shown inside chips. | ||
typedef LabelWidgetBuilder<T> = Widget Function(T? value, String? title); | ||
|
||
/// A Custom chip with a disabled and enabled design based on [isSelected]. | ||
class CustomChip<T> extends StatelessWidget { | ||
/// Initializes a [CustomChip] widget. | ||
const CustomChip({ | ||
this.value, | ||
this.labelBuilder, | ||
this.labelWidgetBuilder, | ||
this.title, | ||
this.isSelected = true, | ||
this.textStyle, | ||
this.onTap, | ||
this.borderRadius = ThemeProvider.borderRadius04, | ||
this.activeBackgroundColor, | ||
Key? key, | ||
}) : assert( | ||
value != null || labelWidgetBuilder != null, | ||
'Both value and labelWidgetBuilder cannot be null at the same time.', | ||
), | ||
super(key: key); | ||
|
||
/// Whether the chip is displayed as selected or not. | ||
final bool isSelected; | ||
|
||
/// The title text to be shown inside of the chip. | ||
final String? title; | ||
|
||
/// The value text to be shown inside of the chip. | ||
final T? value; | ||
|
||
/// To get the content to be shown inside chips. | ||
final LabelBuilder<T>? labelBuilder; | ||
|
||
/// To get the widget to be shown inside chips. | ||
final LabelWidgetBuilder<T>? labelWidgetBuilder; | ||
|
||
/// Called when a custom chip is tapped. | ||
/// Pass [onTap] as null to disable the functionality of the chips. | ||
final OnTapCustomChip<T>? onTap; | ||
|
||
/// The border radius of chips container. | ||
final double borderRadius; | ||
|
||
/// Container background color when [isSelected] is true. | ||
/// | ||
/// If null then [base6] apply as container background. | ||
final Color? activeBackgroundColor; | ||
|
||
/// TextStyle of the chip title. | ||
final TextStyle? textStyle; | ||
|
||
@override | ||
Widget build(BuildContext context) => TextButton( | ||
style: TextButton.styleFrom( | ||
backgroundColor: _backgroundColor(context), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(borderRadius), | ||
), | ||
), | ||
), | ||
onPressed: onTap == null ? null : () => onTap?.call(value, title), | ||
child: labelWidgetBuilder?.call(value, title) ?? | ||
Text( | ||
labelBuilder?.call(value, title) ?? | ||
"${title ?? ''}${title == null ? '' : ': '}$value", | ||
style: context.theme.textStyle( | ||
textStyle: textStyle ?? TextStyles.body1, | ||
color: _textColor(context), | ||
), | ||
), | ||
); | ||
|
||
Color _backgroundColor(BuildContext context) => isSelected | ||
? activeBackgroundColor ?? context.theme.colors.active | ||
: context.theme.colors.secondary; | ||
|
||
Color _textColor(BuildContext context) => isSelected | ||
? context.theme.colors.prominent | ||
: context.theme.colors.lessProminent; | ||
} |
80 changes: 80 additions & 0 deletions
80
packages/deriv_mobile_chart_wrapper/lib/src/core_widgets/deriv_badge.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:deriv_theme/deriv_theme.dart'; | ||
|
||
/// This widget displays a widget with the possibility of showing a badge icon | ||
/// with a count value on the widget | ||
class DerivBadge extends StatelessWidget { | ||
/// Initializes the widget. | ||
const DerivBadge({ | ||
super.key, | ||
this.child, | ||
this.count, | ||
this.enabled = true, | ||
this.alignment = Alignment.topRight, | ||
}); | ||
|
||
/// The widget that is going to be displayed. | ||
final Widget? child; | ||
|
||
/// Is the badge of the widget is going to be displayed or not | ||
/// | ||
/// Default is true. | ||
final bool enabled; | ||
|
||
/// Displays a count value in the badge widget. | ||
final int? count; | ||
|
||
/// The position of the badge. | ||
/// | ||
/// Default is [Alignment.topRight]. | ||
final Alignment alignment; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final bool showDot = count == null; | ||
final bool hasCount = !showDot && count! > 0; | ||
|
||
return Stack( | ||
alignment: alignment, | ||
children: <Widget>[ | ||
Padding( | ||
padding: const EdgeInsets.all(ThemeProvider.margin04), | ||
child: child ?? const SizedBox(), | ||
), | ||
Visibility( | ||
visible: enabled, | ||
child: Container( | ||
decoration: showDot || hasCount | ||
? BoxDecoration( | ||
shape: BoxShape.circle, | ||
color: context.theme.colors.danger, | ||
) | ||
: const BoxDecoration(), | ||
constraints: BoxConstraints( | ||
minWidth: | ||
showDot ? ThemeProvider.margin12 : ThemeProvider.margin16, | ||
minHeight: | ||
showDot ? ThemeProvider.margin12 : ThemeProvider.margin16, | ||
), | ||
child: hasCount | ||
? SizedBox( | ||
width: ThemeProvider.margin16, | ||
height: ThemeProvider.margin16, | ||
child: Center( | ||
child: Text( | ||
'$count', | ||
textAlign: TextAlign.center, | ||
style: context.theme.textStyle( | ||
textStyle: TextStyles.badgeCounter, | ||
), | ||
), | ||
), | ||
) | ||
: const SizedBox.shrink(), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.