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