Skip to content

Commit

Permalink
Merge pull request #96 from Fam-Story/91-fix-알림창-상호작용-수정
Browse files Browse the repository at this point in the history
:Feat: 알림창 상호작용 수청
  • Loading branch information
gw282 authored Dec 11, 2023
2 parents 3e9303f + c4055e8 commit 31a2e82
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions lib/models/family_interaction_model.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
class FamilyInteractionModel {
final int interactionId, srcMemberId, dstMemberId, interactionType, isChecked;
final int interactionId, srcMemberId, dstMemberId, interactionType, isChecked, srcMemberRole;
final String srcMemberNickname;

FamilyInteractionModel.fromJson(Map<String, dynamic> json)
: interactionId = json['interactionId'],
srcMemberId = json['srcMemberId'],
srcMemberRole = json['srcMemberRole'],
srcMemberNickname = json['srcMemberNickname'],
dstMemberId = json['dstMemberId'],
isChecked = json['isChecked'],
interactionType = json['interactionType'];
}
}
49 changes: 33 additions & 16 deletions lib/pages/alarm_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,14 @@ class _AlarmPageState extends State<AlarmPage> with TickerProviderStateMixin {
late Future<List<FamilyInteractionModel>> interactions;
late Future<FamilyMemberModel> _familyMember;
int familyMemberId = 0;
int _role = 0;
String _nickname = '';


@override
void initState() {
super.initState();
}

Future<void> _updateInteractions(int id) async {
_familyMember = FamilyMemberApiService.getFamilyMemberID(id);
_familyMember.then((value) {
_role = value.role;
_nickname = value.nickname;}
);
}


@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -129,20 +122,18 @@ class _AlarmPageState extends State<AlarmPage> with TickerProviderStateMixin {
// If no data is available, display a message indicating no interactions
return Container(
height: 450,
child: Center(child: Text('No Reactions yet.')));
child: Center(child: Text('No reactions yet.')));
} else {
// Data has been successfully fetched, display the interactions
List<FamilyInteractionModel> interactions = snapshot.data!;

return ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: interactions.length,
itemBuilder: (BuildContext context, int index) {
final item = interactions[interactions.length - 1 - index];
bool isChecked = item.isChecked == 0;

_updateInteractions(item.srcMemberId);

return Container(
height: 60,
color: isChecked ? Colors.white : Colors.grey[200],
Expand All @@ -151,19 +142,27 @@ class _AlarmPageState extends State<AlarmPage> with TickerProviderStateMixin {
SizedBox(width: 10),
CircleAvatar(
radius: 20,
backgroundColor: Colors.blue,
child: ClipOval(
child: Center(
child: Image.asset(
getRoleImage(item.srcMemberRole),
fit: BoxFit.fill,
width: 40, // 원하는 너비로 조절
height: 40, // 원하는 높이로 조절
),
),
),
),
SizedBox(width: 10),
CircleAvatar(
radius: 12,
backgroundColor: Colors.blue,
child: ClipOval(
child: getImageForInteractionType(item.interactionType),
),
),
SizedBox(width: 10),
Text(
"${_nickname} ${getInteractionTypeText(item.interactionType)}",
"${item.srcMemberNickname} ${getInteractionTypeText(item.interactionType)}",
style: TextStyle(
color: item.isChecked == 0 ? Colors.black : Colors.grey[400],
fontWeight: FontWeight.bold,
Expand Down Expand Up @@ -276,4 +275,22 @@ class _AlarmPageState extends State<AlarmPage> with TickerProviderStateMixin {
}
}

String getRoleImage(int role) {
switch (role) {
case 1:
return 'assets/images/grandfather.png';
case 2:
return 'assets/images/dad.png';
case 3:
return 'assets/images/son.png';
case 4:
return 'assets/images/grandmother.png';
case 5:
return 'assets/images/mom.png';
case 6:
return 'assets/images/daughter.png';
default:
return 'assets/images/son.png';
}
}
}
2 changes: 0 additions & 2 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class _HomePageState extends State<HomePage> {
int familyId = 0;
int familyMemberID = 0;
int familyMemberNum = 0;
String? message;
bool click1 = false;
bool click2 = false;
bool click3 = false;
Expand All @@ -64,7 +63,6 @@ class _HomePageState extends State<HomePage> {
Future<void> _initData() async {
familyId = context.read<IdProvider>().familyId;
familyMemberID = context.read<IdProvider>().familyMemberId;
message = context.read<IdProvider>().introMessage;
_allFamilyMember = FamilyMemberApiService.getAllFamilyMember(familyId);
_allFamilyMember.then((value) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ class _SettingPageState extends State<SettingPage> with TickerProviderStateMixin
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
Navigator.push(context, MaterialPageRoute(builder: (context) => const LoginSignUpPage()));
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const LoginSignUpPage()));
},
style: TextButton.styleFrom(
foregroundColor: AppColor.objectColor,
Expand Down

0 comments on commit 31a2e82

Please sign in to comment.