feat(shared): legacy presentation/ + shared design system + widgets
- lib/presentation : pages legacy (explore/network, notifications) avec BLoC - lib/shared/design_system : UnionFlow Design System v2 (tokens, components) + MD3 tokens + module_colors par feature - lib/shared/widgets : widgets transversaux (core_card, core_shimmer, error_widget, loading_widget, powered_by_lions_dev, etc.) - lib/shared/constants + utils
This commit is contained in:
@@ -3,6 +3,7 @@ library validated_text_field;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../design_system/tokens/app_colors.dart';
|
||||
|
||||
/// Validated text field with consistent styling and behavior
|
||||
class ValidatedTextField extends StatelessWidget {
|
||||
@@ -61,6 +62,7 @@ class ValidatedTextField extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
initialValue: initialValue,
|
||||
@@ -73,30 +75,32 @@ class ValidatedTextField extends StatelessWidget {
|
||||
border: const OutlineInputBorder(),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade400,
|
||||
color: isDark ? AppColors.borderDark : AppColors.border,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blue,
|
||||
color: AppColors.primary,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
errorBorder: const OutlineInputBorder(
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.red,
|
||||
color: AppColors.error,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: const OutlineInputBorder(
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.red,
|
||||
color: AppColors.error,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
filled: !enabled,
|
||||
fillColor: !enabled ? Colors.grey.shade100 : null,
|
||||
fillColor: !enabled
|
||||
? (isDark ? AppColors.surfaceVariantDark : AppColors.backgroundSubtle)
|
||||
: null,
|
||||
counterText: showCounter ? null : '',
|
||||
),
|
||||
validator: validator,
|
||||
@@ -165,10 +169,10 @@ class ValidatedAmountField extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Text(
|
||||
currencySymbol,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey,
|
||||
color: AppColors.textTertiary,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -206,6 +210,7 @@ class ValidatedDropdownField<T> extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return DropdownButtonFormField<T>(
|
||||
value: value,
|
||||
items: items,
|
||||
@@ -216,24 +221,26 @@ class ValidatedDropdownField<T> extends StatelessWidget {
|
||||
border: const OutlineInputBorder(),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade400,
|
||||
color: isDark ? AppColors.borderDark : AppColors.border,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blue,
|
||||
color: AppColors.primary,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
errorBorder: const OutlineInputBorder(
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.red,
|
||||
color: AppColors.error,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
filled: !enabled,
|
||||
fillColor: !enabled ? Colors.grey.shade100 : null,
|
||||
fillColor: !enabled
|
||||
? (isDark ? AppColors.surfaceVariantDark : AppColors.backgroundSubtle)
|
||||
: null,
|
||||
),
|
||||
validator: validator,
|
||||
onChanged: enabled ? onChanged : null,
|
||||
@@ -269,6 +276,7 @@ class ValidatedDateField extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return InkWell(
|
||||
onTap: enabled
|
||||
? () async {
|
||||
@@ -292,24 +300,26 @@ class ValidatedDateField extends StatelessWidget {
|
||||
border: const OutlineInputBorder(),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade400,
|
||||
color: isDark ? AppColors.borderDark : AppColors.border,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blue,
|
||||
color: AppColors.primary,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
errorBorder: const OutlineInputBorder(
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.red,
|
||||
color: AppColors.error,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
filled: !enabled,
|
||||
fillColor: !enabled ? Colors.grey.shade100 : null,
|
||||
fillColor: !enabled
|
||||
? (isDark ? AppColors.surfaceVariantDark : AppColors.backgroundSubtle)
|
||||
: null,
|
||||
errorText: validator != null ? validator!(selectedDate) : null,
|
||||
),
|
||||
child: Text(
|
||||
@@ -317,7 +327,9 @@ class ValidatedDateField extends StatelessWidget {
|
||||
? '${selectedDate!.day}/${selectedDate!.month}/${selectedDate!.year}'
|
||||
: hintText ?? 'Sélectionner une date',
|
||||
style: TextStyle(
|
||||
color: selectedDate != null ? Colors.black87 : Colors.grey,
|
||||
color: selectedDate != null
|
||||
? (isDark ? AppColors.textPrimaryDark : AppColors.textPrimary)
|
||||
: AppColors.textTertiary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user