From 00fe0012114ff43a2ea8e03f989725280878ed3b Mon Sep 17 00:00:00 2001 From: Yuta1409 Date: Fri, 15 Mar 2024 16:44:45 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F:=20refactor=20profil=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/profils/views/profil_page.dart | 47 ++----------------- .../views/widgets/user_class_card.dart | 35 ++++++++++++++ .../profils/views/widgets/user_info_card.dart | 35 ++++++++++++++ 3 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 frontend/app_student/lib/profils/views/widgets/user_class_card.dart create mode 100644 frontend/app_student/lib/profils/views/widgets/user_info_card.dart diff --git a/frontend/app_student/lib/profils/views/profil_page.dart b/frontend/app_student/lib/profils/views/profil_page.dart index 09356f4..f8cc854 100644 --- a/frontend/app_student/lib/profils/views/profil_page.dart +++ b/frontend/app_student/lib/profils/views/profil_page.dart @@ -1,10 +1,11 @@ import 'package:app_student/class_groups/views/widgets/header/header_text.dart'; import 'package:app_student/menu/menu_view.dart'; import 'package:app_student/profils/views/widgets/class_group_button.dart'; +import 'package:app_student/profils/views/widgets/user_class_card.dart'; +import 'package:app_student/profils/views/widgets/user_info_card.dart'; import 'package:flutter/material.dart'; import 'package:app_student/login/widgets/header/header_logo.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; @@ -42,48 +43,8 @@ class ProfilPage extends StatelessWidget { '${AppLocalizations.of(context)!.profilMessageTitle} $firstName', ), ), - Padding( - padding: const EdgeInsets.all(30.0), - child: Card( - child: ListTile( - leading: SizedBox( - width: 50, - child: ColorFiltered( - colorFilter: const ColorFilter.mode( - Color(0xFF005067), BlendMode.srcIn), - child: SvgPicture.asset( - 'assets/images/user.svg', - width: 30, - height: 30, - ), - ), - ), - title: Text(className), - subtitle: Text(firstName), - ), - ), - ), - Padding( - padding: const EdgeInsets.all(30.0), - child: Card( - child: ListTile( - leading: SizedBox( - width: 50, - child: ColorFiltered( - colorFilter: const ColorFilter.mode( - Color(0xFF005067), BlendMode.srcIn), - child: SvgPicture.asset( - 'assets/images/student-info.svg', - width: 30, - height: 30, - ), - ), - ), - title: Text(ine), - subtitle: Text(birthDateString), - ), - ), - ), + UserClassCard(className: className, firstName: firstName), + UserInfoCard(ine: ine, birthDate: birthDateString), const ClassGroupButton(), ], ), diff --git a/frontend/app_student/lib/profils/views/widgets/user_class_card.dart b/frontend/app_student/lib/profils/views/widgets/user_class_card.dart new file mode 100644 index 0000000..bbb77c0 --- /dev/null +++ b/frontend/app_student/lib/profils/views/widgets/user_class_card.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +class UserClassCard extends StatelessWidget { + final String className; + final String firstName; + + UserClassCard({required this.className, required this.firstName}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(30.0), + child: Card( + child: ListTile( + leading: SizedBox( + width: 50, + child: ColorFiltered( + colorFilter: const ColorFilter.mode( + Color(0xFF005067), BlendMode.srcIn), + child: SvgPicture.asset( + 'assets/images/user.svg', + width: 30, + height: 30, + ), + ), + ), + title: Text(className), + subtitle: Text(firstName), + ), + ), + ); + } +} \ No newline at end of file diff --git a/frontend/app_student/lib/profils/views/widgets/user_info_card.dart b/frontend/app_student/lib/profils/views/widgets/user_info_card.dart new file mode 100644 index 0000000..12f5151 --- /dev/null +++ b/frontend/app_student/lib/profils/views/widgets/user_info_card.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +class UserInfoCard extends StatelessWidget { + final String ine; + final String birthDate; + + UserInfoCard({required this.ine, required this.birthDate}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(30.0), + child: Card( + child: ListTile( + leading: SizedBox( + width: 50, + child: ColorFiltered( + colorFilter: const ColorFilter.mode( + Color(0xFF005067), BlendMode.srcIn), + child: SvgPicture.asset( + 'assets/images/student-info.svg', + width: 30, + height: 30, + ), + ), + ), + title: Text(ine), + subtitle: Text(birthDate), + ), + ), + ); + } +} \ No newline at end of file