sync components with latest design edits
This commit is contained in:
parent
e6310cdd5c
commit
cde669b846
|
|
@ -7,6 +7,7 @@ enum AppState {
|
|||
|
||||
enum ButtonStyleMode {
|
||||
primary,
|
||||
secondary,
|
||||
flat,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,16 +14,18 @@ class DidvanBadge extends StatelessWidget {
|
|||
return Container(
|
||||
height: 24,
|
||||
width: 24,
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: DidvanText(
|
||||
text,
|
||||
isEnglishFont: true,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.overline,
|
||||
color: Theme.of(context).colorScheme.white,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,30 +17,46 @@ class DidvanButton extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color foregroundColor = Colors.black;
|
||||
Color backgroundColor = Colors.black;
|
||||
switch (style) {
|
||||
case ButtonStyleMode.primary:
|
||||
backgroundColor = Theme.of(context).colorScheme.primary;
|
||||
foregroundColor = Theme.of(context).colorScheme.white;
|
||||
break;
|
||||
case ButtonStyleMode.secondary:
|
||||
backgroundColor = Theme.of(context).colorScheme.secondCTA;
|
||||
foregroundColor = Theme.of(context).colorScheme.text;
|
||||
break;
|
||||
case ButtonStyleMode.flat:
|
||||
backgroundColor = Theme.of(context).colorScheme.surface;
|
||||
foregroundColor = Theme.of(context).colorScheme.white;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 48,
|
||||
width: double.infinity,
|
||||
child: MaterialButton(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: DesignConfig.lowBorderRadius,
|
||||
),
|
||||
height: 48,
|
||||
color: style == ButtonStyleMode.primary
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.secondCTA,
|
||||
color: backgroundColor,
|
||||
onPressed: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
onPressed?.call();
|
||||
},
|
||||
child: _childBuilder(),
|
||||
child: _childBuilder(foregroundColor),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget? _childBuilder() {
|
||||
Widget? _childBuilder(Color color) {
|
||||
if (title != null) {
|
||||
return DidvanText(
|
||||
title!,
|
||||
color: Colors.white,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class DidvanCard extends StatelessWidget {
|
|||
padding: padding,
|
||||
margin: margin,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: DesignConfig.lowBorderRadius,
|
||||
borderRadius: DesignConfig.mediumBorderRadius,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: enableBorder ? DesignConfig.cardBorder : null,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:didvan/constants/app_icons.dart';
|
|||
import 'package:didvan/widgets/animated_visibility.dart';
|
||||
import 'package:didvan/widgets/didvan/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:persian_number_utility/persian_number_utility.dart';
|
||||
|
||||
class DidvanTextField extends StatefulWidget {
|
||||
final void Function(String value)? onChanged;
|
||||
|
|
@ -66,6 +67,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
|
|||
),
|
||||
if (widget.title != null) const SizedBox(height: 8),
|
||||
Container(
|
||||
height: 48,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12).copyWith(
|
||||
left: widget.obsecureText ? 0 : 12,
|
||||
),
|
||||
|
|
@ -162,9 +164,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
|
|||
});
|
||||
},
|
||||
child: Icon(
|
||||
_hideContent
|
||||
? DidvanIcons.eye_regular
|
||||
: DidvanIcons.eye_slash_regular,
|
||||
_hideContent ? DidvanIcons.eye_solid : DidvanIcons.eye_slash_solid,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -172,6 +172,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
|
|||
}
|
||||
|
||||
void _onChanged(String value) {
|
||||
value = value.toEnglishDigit();
|
||||
if (widget.onChanged != null) {
|
||||
widget.onChanged!(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue