style: apply dart format across project
This commit is contained in:
@@ -59,7 +59,7 @@ class BaseTextField extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -90,10 +90,11 @@ class BaseTextField extends StatelessWidget {
|
||||
minLines: minLines,
|
||||
readOnly: readOnly,
|
||||
cursorColor: cursorColor ?? theme.primaryColor,
|
||||
style: style ?? TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
style: style ??
|
||||
TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
hintStyle: TextStyle(
|
||||
@@ -146,4 +147,4 @@ class BaseTextField extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class BillingCycleSelector extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalizations.of(context);
|
||||
// 상세 화면에서는 '매월', 추가 화면에서는 '월간'으로 표시
|
||||
final cycles = isGlassmorphism
|
||||
final cycles = isGlassmorphism
|
||||
? [
|
||||
localization.billingCycleMonthly,
|
||||
localization.billingCycleQuarterly,
|
||||
@@ -37,7 +37,7 @@ class BillingCycleSelector extends StatelessWidget {
|
||||
localization.billingCycleHalfYearly,
|
||||
localization.yearly,
|
||||
];
|
||||
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
@@ -76,7 +76,7 @@ class BillingCycleSelector extends StatelessWidget {
|
||||
|
||||
Color _getBackgroundColor(bool isSelected) {
|
||||
if (!isSelected) {
|
||||
return isGlassmorphism
|
||||
return isGlassmorphism
|
||||
? AppColors.backgroundColor
|
||||
: Colors.grey.withValues(alpha: 0.1);
|
||||
}
|
||||
@@ -84,11 +84,11 @@ class BillingCycleSelector extends StatelessWidget {
|
||||
if (baseColor != null) {
|
||||
return baseColor!;
|
||||
}
|
||||
|
||||
|
||||
if (gradientColors != null && gradientColors!.isNotEmpty) {
|
||||
return gradientColors![0];
|
||||
}
|
||||
|
||||
|
||||
return const Color(0xFF3B82F6);
|
||||
}
|
||||
|
||||
@@ -106,8 +106,6 @@ class BillingCycleSelector extends StatelessWidget {
|
||||
if (isSelected) {
|
||||
return Colors.white;
|
||||
}
|
||||
return isGlassmorphism
|
||||
? AppColors.darkNavy
|
||||
: Colors.grey[700]!;
|
||||
return isGlassmorphism ? AppColors.darkNavy : Colors.grey[700]!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ class CategorySelector extends StatelessWidget {
|
||||
Consumer<CategoryProvider>(
|
||||
builder: (context, categoryProvider, child) {
|
||||
return Text(
|
||||
categoryProvider.getLocalizedCategoryName(context, category.name),
|
||||
categoryProvider.getLocalizedCategoryName(
|
||||
context, category.name),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -101,7 +102,7 @@ class CategorySelector extends StatelessWidget {
|
||||
|
||||
Color _getBackgroundColor(bool isSelected) {
|
||||
if (!isSelected) {
|
||||
return isGlassmorphism
|
||||
return isGlassmorphism
|
||||
? AppColors.backgroundColor
|
||||
: Colors.grey.withValues(alpha: 0.1);
|
||||
}
|
||||
@@ -109,11 +110,11 @@ class CategorySelector extends StatelessWidget {
|
||||
if (baseColor != null) {
|
||||
return baseColor!;
|
||||
}
|
||||
|
||||
|
||||
if (gradientColors != null && gradientColors!.isNotEmpty) {
|
||||
return gradientColors![0];
|
||||
}
|
||||
|
||||
|
||||
return const Color(0xFF3B82F6);
|
||||
}
|
||||
|
||||
@@ -131,8 +132,6 @@ class CategorySelector extends StatelessWidget {
|
||||
if (isSelected) {
|
||||
return Colors.white;
|
||||
}
|
||||
return isGlassmorphism
|
||||
? AppColors.darkNavy
|
||||
: Colors.grey[700]!;
|
||||
return isGlassmorphism ? AppColors.darkNavy : Colors.grey[700]!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class _CurrencyInputFieldState extends State<CurrencyInputField> {
|
||||
super.initState();
|
||||
_focusNode = widget.focusNode ?? FocusNode();
|
||||
_focusNode.addListener(_onFocusChanged);
|
||||
|
||||
|
||||
// 초기값이 있으면 포맷팅 적용
|
||||
if (widget.controller.text.isNotEmpty) {
|
||||
final value = double.tryParse(widget.controller.text.replaceAll(',', ''));
|
||||
@@ -105,7 +105,11 @@ class _CurrencyInputFieldState extends State<CurrencyInputField> {
|
||||
}
|
||||
|
||||
double? _parseValue(String text) {
|
||||
final cleanText = text.replaceAll(',', '').replaceAll('₩', '').replaceAll('\$', '').trim();
|
||||
final cleanText = text
|
||||
.replaceAll(',', '')
|
||||
.replaceAll('₩', '')
|
||||
.replaceAll('\$', '')
|
||||
.trim();
|
||||
return double.tryParse(cleanText);
|
||||
}
|
||||
|
||||
@@ -128,16 +132,13 @@ class _CurrencyInputFieldState extends State<CurrencyInputField> {
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
widget.currency == 'KRW'
|
||||
? RegExp(r'[0-9]')
|
||||
: RegExp(r'[0-9.]')
|
||||
),
|
||||
widget.currency == 'KRW' ? RegExp(r'[0-9]') : RegExp(r'[0-9.]')),
|
||||
if (widget.currency == 'USD')
|
||||
// USD의 경우 소수점 이하 2자리까지만 허용
|
||||
TextInputFormatter.withFunction((oldValue, newValue) {
|
||||
final text = newValue.text;
|
||||
if (text.isEmpty) return newValue;
|
||||
|
||||
|
||||
final parts = text.split('.');
|
||||
if (parts.length > 2) {
|
||||
// 소수점이 2개 이상인 경우 거부
|
||||
@@ -157,16 +158,17 @@ class _CurrencyInputFieldState extends State<CurrencyInputField> {
|
||||
final parsedValue = _parseValue(value);
|
||||
widget.onChanged?.call(parsedValue);
|
||||
},
|
||||
validator: widget.validator ?? (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context).amountRequired;
|
||||
}
|
||||
final parsedValue = _parseValue(value);
|
||||
if (parsedValue == null || parsedValue <= 0) {
|
||||
return AppLocalizations.of(context).invalidAmount;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
validator: widget.validator ??
|
||||
(value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context).amountRequired;
|
||||
}
|
||||
final parsedValue = _parseValue(value);
|
||||
if (parsedValue == null || parsedValue <= 0) {
|
||||
return AppLocalizations.of(context).invalidAmount;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class _CurrencyOption extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
@@ -131,11 +131,9 @@ class _CurrencyOption extends StatelessWidget {
|
||||
|
||||
Color _getBackgroundColor(ThemeData theme) {
|
||||
if (isSelected) {
|
||||
return isGlassmorphism
|
||||
? theme.primaryColor
|
||||
: const Color(0xFF3B82F6);
|
||||
return isGlassmorphism ? theme.primaryColor : const Color(0xFF3B82F6);
|
||||
}
|
||||
return isGlassmorphism
|
||||
return isGlassmorphism
|
||||
? AppColors.surfaceColorAlt
|
||||
: Colors.grey.withValues(alpha: 0.1);
|
||||
}
|
||||
@@ -154,8 +152,6 @@ class _CurrencyOption extends StatelessWidget {
|
||||
if (isSelected) {
|
||||
return Colors.white;
|
||||
}
|
||||
return isGlassmorphism
|
||||
? AppColors.navyGray
|
||||
: Colors.grey[600]!;
|
||||
return isGlassmorphism ? AppColors.navyGray : Colors.grey[600]!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class DatePickerField extends StatelessWidget {
|
||||
final localizations = AppLocalizations.of(context);
|
||||
final effectiveDateFormat = dateFormat ?? localizations.dateFormatFull;
|
||||
final locale = Localizations.localeOf(context);
|
||||
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -57,31 +57,35 @@ class DatePickerField extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
InkWell(
|
||||
focusNode: focusNode,
|
||||
onTap: enabled ? () async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: selectedDate,
|
||||
firstDate: firstDate ?? DateTime.now().subtract(const Duration(days: 365 * 10)),
|
||||
lastDate: lastDate ?? DateTime.now().add(const Duration(days: 365 * 10)),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Theme(
|
||||
data: ThemeData.light().copyWith(
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: effectivePrimaryColor,
|
||||
onPrimary: Colors.white,
|
||||
surface: Colors.white,
|
||||
onSurface: Colors.black,
|
||||
),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (picked != null && picked != selectedDate) {
|
||||
onDateSelected(picked);
|
||||
}
|
||||
} : null,
|
||||
onTap: enabled
|
||||
? () async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: selectedDate,
|
||||
firstDate: firstDate ??
|
||||
DateTime.now().subtract(const Duration(days: 365 * 10)),
|
||||
lastDate: lastDate ??
|
||||
DateTime.now().add(const Duration(days: 365 * 10)),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Theme(
|
||||
data: ThemeData.light().copyWith(
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: effectivePrimaryColor,
|
||||
onPrimary: Colors.white,
|
||||
surface: Colors.white,
|
||||
onSurface: Colors.black,
|
||||
),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (picked != null && picked != selectedDate) {
|
||||
onDateSelected(picked);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
padding: contentPadding ?? const EdgeInsets.all(16),
|
||||
@@ -97,21 +101,19 @@ class DatePickerField extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
DateFormat(effectiveDateFormat, locale.toString()).format(selectedDate),
|
||||
DateFormat(effectiveDateFormat, locale.toString())
|
||||
.format(selectedDate),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: enabled
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textMuted,
|
||||
color:
|
||||
enabled ? AppColors.textPrimary : AppColors.textMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.calendar_today,
|
||||
size: 20,
|
||||
color: enabled
|
||||
? AppColors.navyGray
|
||||
: AppColors.textMuted,
|
||||
color: enabled ? AppColors.navyGray : AppColors.textMuted,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -158,7 +160,8 @@ class DateRangePickerField extends StatelessWidget {
|
||||
primaryColor: primaryColor,
|
||||
onDateSelected: onStartDateSelected,
|
||||
firstDate: DateTime.now().subtract(const Duration(days: 365)),
|
||||
lastDate: endDate ?? DateTime.now().add(const Duration(days: 365 * 2)),
|
||||
lastDate:
|
||||
endDate ?? DateTime.now().add(const Duration(days: 365 * 2)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -203,31 +206,33 @@ class _DateRangeItem extends StatelessWidget {
|
||||
final effectivePrimaryColor = primaryColor ?? theme.primaryColor;
|
||||
|
||||
return InkWell(
|
||||
onTap: enabled ? () async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: date ?? DateTime.now(),
|
||||
firstDate: firstDate,
|
||||
lastDate: lastDate,
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Theme(
|
||||
data: ThemeData.light().copyWith(
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: effectivePrimaryColor,
|
||||
onPrimary: Colors.white,
|
||||
surface: Colors.white,
|
||||
onSurface: Colors.black,
|
||||
),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (picked != null) {
|
||||
onDateSelected(picked);
|
||||
}
|
||||
} : null,
|
||||
onTap: enabled
|
||||
? () async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: date ?? DateTime.now(),
|
||||
firstDate: firstDate,
|
||||
lastDate: lastDate,
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Theme(
|
||||
data: ThemeData.light().copyWith(
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: effectivePrimaryColor,
|
||||
onPrimary: Colors.white,
|
||||
surface: Colors.white,
|
||||
onSurface: Colors.black,
|
||||
),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (picked != null) {
|
||||
onDateSelected(picked);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -252,14 +257,14 @@ class _DateRangeItem extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
date != null
|
||||
? DateFormat(AppLocalizations.of(context).dateFormatShort).format(date!)
|
||||
? DateFormat(AppLocalizations.of(context).dateFormatShort)
|
||||
.format(date!)
|
||||
: AppLocalizations.of(context).dateSelect,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: date != null
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textMuted,
|
||||
color:
|
||||
date != null ? AppColors.textPrimary : AppColors.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -267,4 +272,4 @@ class _DateRangeItem extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user