Skip to content

Commit ea0e29c

Browse files
authored
fix: 가족 이름 6자 초과할 시 예외 처리 (#54)
1 parent c2aac79 commit ea0e29c

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

frontend/ongi/lib/screens/signup/familyname_screen.dart

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,37 @@ class _FamilynameScreenState extends State<FamilynameScreen> {
3535
return;
3636
}
3737

38+
if (familyName.length > 6) {
39+
ScaffoldMessenger.of(context).showSnackBar(
40+
SnackBar(
41+
content: const Text(
42+
'가족이름은 6자 이하여야 해요.',
43+
style: TextStyle(color: AppColors.ongiOrange),
44+
),
45+
backgroundColor: Colors.white,
46+
behavior: SnackBarBehavior.floating,
47+
shape: RoundedRectangleBorder(
48+
borderRadius: BorderRadius.circular(20),
49+
),
50+
duration: const Duration(seconds: 2),
51+
),
52+
);
53+
return;
54+
}
55+
3856
try {
3957
final prefs = await SharedPreferences.getInstance();
4058
await prefs.setString('family_name', familyName);
4159

4260
if (!mounted) return;
4361
Navigator.push(
4462
context,
45-
MaterialPageRoute(
46-
builder: (context) => FamilycodeCreateScreen(),
47-
),
63+
MaterialPageRoute(builder: (context) => FamilycodeCreateScreen()),
4864
);
4965
} catch (e) {
50-
ScaffoldMessenger.of(context).showSnackBar(
51-
SnackBar(content: Text('오류가 발생했습니다: $e')),
52-
);
66+
ScaffoldMessenger.of(
67+
context,
68+
).showSnackBar(SnackBar(content: Text('오류가 발생했습니다: $e')));
5369
}
5470
}
5571

@@ -122,8 +138,10 @@ class _FamilynameScreenState extends State<FamilynameScreen> {
122138
decoration: InputDecoration(
123139
hintText: 'FAMILYNAME',
124140
hintStyle: const TextStyle(color: Colors.grey),
125-
contentPadding:
126-
const EdgeInsets.symmetric(horizontal: 24, vertical: 13),
141+
contentPadding: const EdgeInsets.symmetric(
142+
horizontal: 24,
143+
vertical: 13,
144+
),
127145
filled: true,
128146
fillColor: Colors.transparent,
129147
enabledBorder: OutlineInputBorder(

0 commit comments

Comments
 (0)