Skip to content

Commit

Permalink
Update widget_toolkkit_qr theme fields
Browse files Browse the repository at this point in the history
  • Loading branch information
DDavidPrime committed Apr 5, 2024
1 parent ceda98c commit cd39582
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 142 deletions.
99 changes: 32 additions & 67 deletions packages/widget_toolkit_qr/lib/src/base/theme/qr_scanner_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ part 'qr_scanner_theme.tailor.dart';
class QrScannerTheme extends ThemeExtension<QrScannerTheme>
with _$QrScannerThemeTailorMixin {
const QrScannerTheme({
required this.cameraPermission1,
required this.cameraPermission2,
required this.cameraPermission3,
required this.cameraPermission4,
required this.cameraPermission5,
required this.cameraPermission6,
required this.qrScannerPage1,
required this.qrScannerPage2,
required this.qrScannerPage3,
required this.qrScannerPage4,
required this.qrScannerPage5,
required this.cameraPermissionPadding,
required this.cameraPermissionBorderPadding,
required this.cameraPermissionContentPadding,
required this.cameraPermissionIconPadding,
required this.cameraPermissionTitlePadding,
required this.qrScannerComponentPadding,
required this.qrScannerCameraPadding,
required this.qrScannerProgressIndicatorPadding,
required this.qrScannerSubtitlePadding,
required this.backButtonMarginEdgeInsets,
required this.backButtonPaddingEdgeInsets,
Expand Down Expand Up @@ -62,46 +59,33 @@ class QrScannerTheme extends ThemeExtension<QrScannerTheme>
/// region Themes
QrScannerTheme.light()
: cameraPermission1 = EdgeInsets.symmetric(
: cameraPermissionPadding = EdgeInsets.symmetric(
horizontal: WidgetToolkitDesignSystem.light().spacings.m,
),
cameraPermission2 = EdgeInsets.only(
cameraPermissionBorderPadding = EdgeInsets.only(
top: WidgetToolkitDesignSystem.light().spacings.xs,
bottom: WidgetToolkitDesignSystem.light().spacings.m,
),
cameraPermission3 = EdgeInsets.all(
cameraPermissionContentPadding = EdgeInsets.all(
WidgetToolkitDesignSystem.light().spacings.m,
),
cameraPermission4 = EdgeInsets.only(
cameraPermissionIconPadding = EdgeInsets.only(
right: WidgetToolkitDesignSystem.light().spacings.m,
),
cameraPermission5 = EdgeInsets.only(
cameraPermissionTitlePadding = EdgeInsets.only(
bottom: WidgetToolkitDesignSystem.light().spacings.xs,
),
cameraPermission6 = EdgeInsets.symmetric(
vertical: WidgetToolkitDesignSystem.light().spacings.m,
),
qrScannerPage1 = EdgeInsets.only(
left: WidgetToolkitDesignSystem.light().spacings.m,
right: WidgetToolkitDesignSystem.light().spacings.m,
bottom: WidgetToolkitDesignSystem.light().spacings.m,
),
qrScannerPage2 = EdgeInsets.only(
qrScannerComponentPadding = EdgeInsets.only(
left: WidgetToolkitDesignSystem.light().spacings.xxxl,
right: WidgetToolkitDesignSystem.light().spacings.xxxl,
),
qrScannerPage3 =
qrScannerCameraPadding =
EdgeInsets.all(WidgetToolkitDesignSystem.light().spacings.xss),
qrScannerPage4 = EdgeInsets.only(
qrScannerProgressIndicatorPadding = EdgeInsets.only(
left: WidgetToolkitDesignSystem.light().spacings.m,
right: WidgetToolkitDesignSystem.light().spacings.m,
bottom: WidgetToolkitDesignSystem.light().spacings.xxxl,
),
qrScannerPage5 = EdgeInsets.only(
left: WidgetToolkitDesignSystem.light().spacings.m,
right: WidgetToolkitDesignSystem.light().spacings.m,
bottom: WidgetToolkitDesignSystem.light().spacings.xxl,
),
qrScannerSubtitlePadding = EdgeInsets.only(
top: WidgetToolkitDesignSystem.light().spacings.xs1),
backButtonMarginEdgeInsets = EdgeInsets.only(
Expand Down Expand Up @@ -168,46 +152,33 @@ class QrScannerTheme extends ThemeExtension<QrScannerTheme>
linearProgressIndicatorColor = _HexColor(_qrFrameBlueColorHex);

QrScannerTheme.dark()
: cameraPermission1 = EdgeInsets.symmetric(
: cameraPermissionPadding = EdgeInsets.symmetric(
horizontal: WidgetToolkitDesignSystem.dark().spacings.m,
),
cameraPermission2 = EdgeInsets.only(
cameraPermissionBorderPadding = EdgeInsets.only(
top: WidgetToolkitDesignSystem.dark().spacings.xs,
bottom: WidgetToolkitDesignSystem.dark().spacings.m,
),
cameraPermission3 = EdgeInsets.all(
cameraPermissionContentPadding = EdgeInsets.all(
WidgetToolkitDesignSystem.dark().spacings.m,
),
cameraPermission4 = EdgeInsets.only(
cameraPermissionIconPadding = EdgeInsets.only(
right: WidgetToolkitDesignSystem.dark().spacings.m,
),
cameraPermission5 = EdgeInsets.only(
cameraPermissionTitlePadding = EdgeInsets.only(
bottom: WidgetToolkitDesignSystem.dark().spacings.xs,
),
cameraPermission6 = EdgeInsets.symmetric(
vertical: WidgetToolkitDesignSystem.dark().spacings.m,
),
qrScannerPage1 = EdgeInsets.only(
left: WidgetToolkitDesignSystem.dark().spacings.m,
right: WidgetToolkitDesignSystem.dark().spacings.m,
bottom: WidgetToolkitDesignSystem.dark().spacings.m,
),
qrScannerPage2 = EdgeInsets.only(
qrScannerComponentPadding = EdgeInsets.only(
left: WidgetToolkitDesignSystem.dark().spacings.xxxl,
right: WidgetToolkitDesignSystem.dark().spacings.xxxl,
),
qrScannerPage3 =
qrScannerCameraPadding =
EdgeInsets.all(WidgetToolkitDesignSystem.dark().spacings.xss),
qrScannerPage4 = EdgeInsets.only(
qrScannerProgressIndicatorPadding = EdgeInsets.only(
left: WidgetToolkitDesignSystem.dark().spacings.m,
right: WidgetToolkitDesignSystem.dark().spacings.m,
bottom: WidgetToolkitDesignSystem.dark().spacings.xxxl,
),
qrScannerPage5 = EdgeInsets.only(
left: WidgetToolkitDesignSystem.dark().spacings.m,
right: WidgetToolkitDesignSystem.dark().spacings.m,
bottom: WidgetToolkitDesignSystem.dark().spacings.xxl,
),
qrScannerSubtitlePadding = EdgeInsets.only(
top: WidgetToolkitDesignSystem.light().spacings.xs1),
backButtonMarginEdgeInsets = EdgeInsets.only(
Expand Down Expand Up @@ -361,28 +332,22 @@ class QrScannerTheme extends ThemeExtension<QrScannerTheme>
final SvgFile backButtonArrowLeft;

@override
final EdgeInsets cameraPermission1;
@override
final EdgeInsets cameraPermission2;
final EdgeInsets cameraPermissionPadding;
@override
final EdgeInsets cameraPermission3;
final EdgeInsets cameraPermissionBorderPadding;
@override
final EdgeInsets cameraPermission4;
final EdgeInsets cameraPermissionContentPadding;
@override
final EdgeInsets cameraPermission5;
final EdgeInsets cameraPermissionIconPadding;
@override
final EdgeInsets cameraPermission6;
final EdgeInsets cameraPermissionTitlePadding;

@override
final EdgeInsets qrScannerPage1;
@override
final EdgeInsets qrScannerPage2;
@override
final EdgeInsets qrScannerPage3;
final EdgeInsets qrScannerComponentPadding;
@override
final EdgeInsets qrScannerPage4;
final EdgeInsets qrScannerCameraPadding;
@override
final EdgeInsets qrScannerPage5;
final EdgeInsets qrScannerProgressIndicatorPadding;
}

extension ThemeContextExtension on BuildContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,14 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
SvgFile get backButtonCloseIcon;
SvgFile get qrScanAreaIcon;
SvgFile get backButtonArrowLeft;
EdgeInsets get cameraPermission1;
EdgeInsets get cameraPermission2;
EdgeInsets get cameraPermission3;
EdgeInsets get cameraPermission4;
EdgeInsets get cameraPermission5;
EdgeInsets get cameraPermission6;
EdgeInsets get qrScannerPage1;
EdgeInsets get qrScannerPage2;
EdgeInsets get qrScannerPage3;
EdgeInsets get qrScannerPage4;
EdgeInsets get qrScannerPage5;
EdgeInsets get cameraPermissionPadding;
EdgeInsets get cameraPermissionBorderPadding;
EdgeInsets get cameraPermissionContentPadding;
EdgeInsets get cameraPermissionIconPadding;
EdgeInsets get cameraPermissionTitlePadding;
EdgeInsets get qrScannerComponentPadding;
EdgeInsets get qrScannerCameraPadding;
EdgeInsets get qrScannerProgressIndicatorPadding;

@override
QrScannerTheme copyWith({
Expand Down Expand Up @@ -99,17 +96,14 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
SvgFile? backButtonCloseIcon,
SvgFile? qrScanAreaIcon,
SvgFile? backButtonArrowLeft,
EdgeInsets? cameraPermission1,
EdgeInsets? cameraPermission2,
EdgeInsets? cameraPermission3,
EdgeInsets? cameraPermission4,
EdgeInsets? cameraPermission5,
EdgeInsets? cameraPermission6,
EdgeInsets? qrScannerPage1,
EdgeInsets? qrScannerPage2,
EdgeInsets? qrScannerPage3,
EdgeInsets? qrScannerPage4,
EdgeInsets? qrScannerPage5,
EdgeInsets? cameraPermissionPadding,
EdgeInsets? cameraPermissionBorderPadding,
EdgeInsets? cameraPermissionContentPadding,
EdgeInsets? cameraPermissionIconPadding,
EdgeInsets? cameraPermissionTitlePadding,
EdgeInsets? qrScannerComponentPadding,
EdgeInsets? qrScannerCameraPadding,
EdgeInsets? qrScannerProgressIndicatorPadding,
}) {
return QrScannerTheme(
qrScannerSubtitlePadding:
Expand Down Expand Up @@ -175,17 +169,22 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
backButtonCloseIcon: backButtonCloseIcon ?? this.backButtonCloseIcon,
qrScanAreaIcon: qrScanAreaIcon ?? this.qrScanAreaIcon,
backButtonArrowLeft: backButtonArrowLeft ?? this.backButtonArrowLeft,
cameraPermission1: cameraPermission1 ?? this.cameraPermission1,
cameraPermission2: cameraPermission2 ?? this.cameraPermission2,
cameraPermission3: cameraPermission3 ?? this.cameraPermission3,
cameraPermission4: cameraPermission4 ?? this.cameraPermission4,
cameraPermission5: cameraPermission5 ?? this.cameraPermission5,
cameraPermission6: cameraPermission6 ?? this.cameraPermission6,
qrScannerPage1: qrScannerPage1 ?? this.qrScannerPage1,
qrScannerPage2: qrScannerPage2 ?? this.qrScannerPage2,
qrScannerPage3: qrScannerPage3 ?? this.qrScannerPage3,
qrScannerPage4: qrScannerPage4 ?? this.qrScannerPage4,
qrScannerPage5: qrScannerPage5 ?? this.qrScannerPage5,
cameraPermissionPadding:
cameraPermissionPadding ?? this.cameraPermissionPadding,
cameraPermissionBorderPadding:
cameraPermissionBorderPadding ?? this.cameraPermissionBorderPadding,
cameraPermissionContentPadding:
cameraPermissionContentPadding ?? this.cameraPermissionContentPadding,
cameraPermissionIconPadding:
cameraPermissionIconPadding ?? this.cameraPermissionIconPadding,
cameraPermissionTitlePadding:
cameraPermissionTitlePadding ?? this.cameraPermissionTitlePadding,
qrScannerComponentPadding:
qrScannerComponentPadding ?? this.qrScannerComponentPadding,
qrScannerCameraPadding:
qrScannerCameraPadding ?? this.qrScannerCameraPadding,
qrScannerProgressIndicatorPadding: qrScannerProgressIndicatorPadding ??
this.qrScannerProgressIndicatorPadding,
);
}

Expand Down Expand Up @@ -274,17 +273,27 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
qrScanAreaIcon: t < 0.5 ? qrScanAreaIcon : other.qrScanAreaIcon,
backButtonArrowLeft:
t < 0.5 ? backButtonArrowLeft : other.backButtonArrowLeft,
cameraPermission1: t < 0.5 ? cameraPermission1 : other.cameraPermission1,
cameraPermission2: t < 0.5 ? cameraPermission2 : other.cameraPermission2,
cameraPermission3: t < 0.5 ? cameraPermission3 : other.cameraPermission3,
cameraPermission4: t < 0.5 ? cameraPermission4 : other.cameraPermission4,
cameraPermission5: t < 0.5 ? cameraPermission5 : other.cameraPermission5,
cameraPermission6: t < 0.5 ? cameraPermission6 : other.cameraPermission6,
qrScannerPage1: t < 0.5 ? qrScannerPage1 : other.qrScannerPage1,
qrScannerPage2: t < 0.5 ? qrScannerPage2 : other.qrScannerPage2,
qrScannerPage3: t < 0.5 ? qrScannerPage3 : other.qrScannerPage3,
qrScannerPage4: t < 0.5 ? qrScannerPage4 : other.qrScannerPage4,
qrScannerPage5: t < 0.5 ? qrScannerPage5 : other.qrScannerPage5,
cameraPermissionPadding:
t < 0.5 ? cameraPermissionPadding : other.cameraPermissionPadding,
cameraPermissionBorderPadding: t < 0.5
? cameraPermissionBorderPadding
: other.cameraPermissionBorderPadding,
cameraPermissionContentPadding: t < 0.5
? cameraPermissionContentPadding
: other.cameraPermissionContentPadding,
cameraPermissionIconPadding: t < 0.5
? cameraPermissionIconPadding
: other.cameraPermissionIconPadding,
cameraPermissionTitlePadding: t < 0.5
? cameraPermissionTitlePadding
: other.cameraPermissionTitlePadding,
qrScannerComponentPadding:
t < 0.5 ? qrScannerComponentPadding : other.qrScannerComponentPadding,
qrScannerCameraPadding:
t < 0.5 ? qrScannerCameraPadding : other.qrScannerCameraPadding,
qrScannerProgressIndicatorPadding: t < 0.5
? qrScannerProgressIndicatorPadding
: other.qrScannerProgressIndicatorPadding,
);
}

Expand Down Expand Up @@ -353,17 +362,14 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
const DeepCollectionEquality().equals(backButtonCloseIcon, other.backButtonCloseIcon) &&
const DeepCollectionEquality().equals(qrScanAreaIcon, other.qrScanAreaIcon) &&
const DeepCollectionEquality().equals(backButtonArrowLeft, other.backButtonArrowLeft) &&
const DeepCollectionEquality().equals(cameraPermission1, other.cameraPermission1) &&
const DeepCollectionEquality().equals(cameraPermission2, other.cameraPermission2) &&
const DeepCollectionEquality().equals(cameraPermission3, other.cameraPermission3) &&
const DeepCollectionEquality().equals(cameraPermission4, other.cameraPermission4) &&
const DeepCollectionEquality().equals(cameraPermission5, other.cameraPermission5) &&
const DeepCollectionEquality().equals(cameraPermission6, other.cameraPermission6) &&
const DeepCollectionEquality().equals(qrScannerPage1, other.qrScannerPage1) &&
const DeepCollectionEquality().equals(qrScannerPage2, other.qrScannerPage2) &&
const DeepCollectionEquality().equals(qrScannerPage3, other.qrScannerPage3) &&
const DeepCollectionEquality().equals(qrScannerPage4, other.qrScannerPage4) &&
const DeepCollectionEquality().equals(qrScannerPage5, other.qrScannerPage5));
const DeepCollectionEquality().equals(cameraPermissionPadding, other.cameraPermissionPadding) &&
const DeepCollectionEquality().equals(cameraPermissionBorderPadding, other.cameraPermissionBorderPadding) &&
const DeepCollectionEquality().equals(cameraPermissionContentPadding, other.cameraPermissionContentPadding) &&
const DeepCollectionEquality().equals(cameraPermissionIconPadding, other.cameraPermissionIconPadding) &&
const DeepCollectionEquality().equals(cameraPermissionTitlePadding, other.cameraPermissionTitlePadding) &&
const DeepCollectionEquality().equals(qrScannerComponentPadding, other.qrScannerComponentPadding) &&
const DeepCollectionEquality().equals(qrScannerCameraPadding, other.qrScannerCameraPadding) &&
const DeepCollectionEquality().equals(qrScannerProgressIndicatorPadding, other.qrScannerProgressIndicatorPadding));
}

@override
Expand Down Expand Up @@ -410,17 +416,14 @@ mixin _$QrScannerThemeTailorMixin on ThemeExtension<QrScannerTheme> {
const DeepCollectionEquality().hash(backButtonCloseIcon),
const DeepCollectionEquality().hash(qrScanAreaIcon),
const DeepCollectionEquality().hash(backButtonArrowLeft),
const DeepCollectionEquality().hash(cameraPermission1),
const DeepCollectionEquality().hash(cameraPermission2),
const DeepCollectionEquality().hash(cameraPermission3),
const DeepCollectionEquality().hash(cameraPermission4),
const DeepCollectionEquality().hash(cameraPermission5),
const DeepCollectionEquality().hash(cameraPermission6),
const DeepCollectionEquality().hash(qrScannerPage1),
const DeepCollectionEquality().hash(qrScannerPage2),
const DeepCollectionEquality().hash(qrScannerPage3),
const DeepCollectionEquality().hash(qrScannerPage4),
const DeepCollectionEquality().hash(qrScannerPage5),
const DeepCollectionEquality().hash(cameraPermissionPadding),
const DeepCollectionEquality().hash(cameraPermissionBorderPadding),
const DeepCollectionEquality().hash(cameraPermissionContentPadding),
const DeepCollectionEquality().hash(cameraPermissionIconPadding),
const DeepCollectionEquality().hash(cameraPermissionTitlePadding),
const DeepCollectionEquality().hash(qrScannerComponentPadding),
const DeepCollectionEquality().hash(qrScannerCameraPadding),
const DeepCollectionEquality().hash(qrScannerProgressIndicatorPadding),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ class _CameraPermissionWidget extends StatelessWidget {

@override
Widget build(BuildContext context) => Padding(
padding: context.qrScannerTheme.cameraPermission1,
padding: context.qrScannerTheme.cameraPermissionPadding,
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: context.qrScannerTheme.cameraPermission2,
padding: context.qrScannerTheme.cameraPermissionBorderPadding,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
Expand All @@ -85,22 +85,24 @@ class _CameraPermissionWidget extends StatelessWidget {
),
),
child: Padding(
padding: context.qrScannerTheme.cameraPermission3,
padding:
context.qrScannerTheme.cameraPermissionContentPadding,
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: context.qrScannerTheme.cameraPermission4,
padding: context
.qrScannerTheme.cameraPermissionIconPadding,
child: context.qrScannerTheme.cameraIcon,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding:
context.qrScannerTheme.cameraPermission5,
padding: context.qrScannerTheme
.cameraPermissionTitlePadding,
child: Text(
cameraAccessTitleText ??
defaultCameraAccessTitleText,
Expand Down
Loading

0 comments on commit cd39582

Please sign in to comment.