Skip to content

Commit

Permalink
updated checkbox toast and dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
rachana-egov committed Oct 27, 2023
1 parent 39b63df commit 5ede3d0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ class _SideEffectsPageState extends LocalizedState<SideEffectsPage> {
),
],
),
const DigitDivider(),
Align(
alignment: Alignment.topLeft,
child: Padding(
padding: const EdgeInsets.all(8),
padding: const EdgeInsets.only(left: 0, right: kPadding, top: kPadding*2, bottom: kPadding*2),
child: Text(
'${localizations.translate(
i18.adverseEvents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:digit_components/digit_components.dart';
import 'package:flutter/material.dart';
import 'package:reactive_forms/reactive_forms.dart';

Expand Down Expand Up @@ -26,15 +27,15 @@ class DigitDropdown<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 16),
padding: const EdgeInsets.only(top: kPadding*2),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$label${isRequired ? ' *' : ''}',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 8),
const SizedBox(height: kPadding),
ReactiveDropdownField(
onChanged: (control) {
final value = control.value;
Expand All @@ -44,7 +45,7 @@ class DigitDropdown<T> extends StatelessWidget {
validationMessages: validationMessages,
formControlName: formControlName,
decoration: const InputDecoration(
contentPadding: EdgeInsets.fromLTRB(16, 12, 0, 12),
contentPadding: EdgeInsets.fromLTRB(kPadding*2, 12, kPadding, 12),
),
items: menuItems
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class DigitReactiveDropdown<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: padding ?? const EdgeInsets.only(top: 16),
padding: padding ?? const EdgeInsets.only(top: kPadding*2),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$label${isRequired ? ' *' : ''}',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 8),
const SizedBox(height: kPadding),
Container(
color: isDisabled
? const DigitColors().seaShellGray
Expand All @@ -59,7 +59,7 @@ class DigitReactiveDropdown<T> extends StatelessWidget {
validationMessages: validationMessages,
formControlName: formControlName,
decoration: const InputDecoration(
contentPadding: EdgeInsets.fromLTRB(16, 12, 0, 12),
contentPadding: EdgeInsets.fromLTRB(kPadding*2, 12, kPadding, 12),
),
items: menuItems
.map(
Expand Down
33 changes: 26 additions & 7 deletions packages/digit_components/lib/widgets/atoms/digit_toaster.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:digit_components/digit_components.dart';
import 'package:digit_components/theme/digit_theme.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
Expand All @@ -18,12 +19,15 @@ class DigitToast {
}) {
ftoast.init(context);

final theme = Theme.of(context);

return ftoast.showToast(
child: Container(
color: options.isError
? options.theme.colorScheme.error
: options.theme.colorScheme.onSurfaceVariant,
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
padding: const EdgeInsets.symmetric(
horizontal: kPadding, vertical: 12.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expand All @@ -32,22 +36,37 @@ class DigitToast {
color: Colors.white,
),
const SizedBox(
width: 12.0,
width: kPadding*2,
),
Expanded(
child: Text(
options.message,
style: const TextStyle(color: Colors.white),
)),
child: Text(
options.message,
style: TextStyle(
fontSize: theme.textTheme.bodyLarge?.fontSize,
fontWeight: theme.textTheme.bodyLarge?.fontWeight,
color: const DigitColors().white,
),
),
),
GestureDetector(
onTap: () {
ftoast.removeCustomToast();
},
child: Icon(
Icons.close,
color: const DigitColors().white,
),
),
],
),
),
gravity: ToastGravity.BOTTOM,
gravity: ToastGravity.SNACKBAR,
toastDuration: DigitTheme.instance.toastDuration,
);
}
}


class DigitToastOptions {
final String message;
final bool isError;
Expand Down
13 changes: 6 additions & 7 deletions packages/digit_components/lib/widgets/digit_checkbox_tile.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:digit_components/digit_components.dart';
import 'package:flutter/material.dart';

class DigitCheckboxTile extends StatelessWidget {
Expand All @@ -21,24 +22,22 @@ class DigitCheckboxTile extends StatelessWidget {
final theme = Theme.of(context);

return Padding(
padding: margin ?? const EdgeInsets.all(8.0),
padding: padding ?? const EdgeInsets.all(0),
child: InkWell(
onTap: () => onChanged?.call(!value),
child: Padding(
padding: padding ??
const EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
),
padding: const EdgeInsets.only(left: 0, bottom: kPadding*2),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
value
? Icons.check_box_outlined
: Icons.check_box_outline_blank_sharp,
color: theme.colorScheme.secondary,
size: kPadding*3,
),
const SizedBox(width: 16),
const SizedBox(width: kPadding*2),
Expanded(
child: Text(
label,
Expand Down

0 comments on commit 5ede3d0

Please sign in to comment.