Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaverse profile #33

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
927c3da
update code to support FDW button
Apr 29, 2024
0d466b1
update FDW PRIMARY color
Apr 29, 2024
710a7ea
Merge branch 'AmityCo:main' into main
arman-garousi-dev May 2, 2024
7e6a26b
Add showAppBar property to CommunityPage class.
Garousi-Developer May 2, 2024
1bf232c
Add a default value for showAppBarTop property.
Garousi-Developer May 2, 2024
baf938f
Fix Newfeed typo.
Garousi-Developer May 2, 2024
e64d109
Fix toolbarHeight issue when showAppBarTop is false.
Garousi-Developer May 2, 2024
a59b8a0
Add showPostToButton property to CommunityPage.
Garousi-Developer May 2, 2024
a1d11be
Add canCreateCommunity property to CommunityPage.
Garousi-Developer May 2, 2024
624337a
Add canSearchCommunities property to CommunityPage.
Garousi-Developer May 2, 2024
a72bb28
Add widgetConfig to AmityUIConfiguration class.
Garousi-Developer May 3, 2024
8f0e66c
Add showEditProfile to AmityWidgetConfig.
Garousi-Developer May 8, 2024
5920d28
Add showPostReview to AmityWidgetConfig.
Garousi-Developer May 8, 2024
707784b
Add showRemoveFromCommunity to AmityWidgetConfig.
Garousi-Developer May 8, 2024
5c6fd34
Add hideModeratorProfile to AmityLogicConfig.
Garousi-Developer May 8, 2024
129cfa5
Add replaceModeratorProfile to AmityLogicConfig.
Garousi-Developer May 8, 2024
b06c936
Add showJoinButton to AmityWidgetConfig.
Garousi-Developer May 9, 2024
2613a7f
Add showCommunityMoreButton to AmityWidgetConfig.
Garousi-Developer May 9, 2024
0de841b
Add ThemeConfig widget above every Scaffold widget.
Garousi-Developer May 13, 2024
8a2b7a2
Add ThemeConfig widget above every Scaffold widget.
Garousi-Developer May 13, 2024
bc4f803
Fix Newsfeed empty space issue.
Garousi-Developer May 13, 2024
09d2417
Add showPromoteAndDismissModerator to AmityWidgetConfig.
Garousi-Developer May 13, 2024
f8b0bd0
Fix Thai font issue in modal bottom sheets.
Garousi-Developer May 13, 2024
6f9ff8b
Add showSelectMemberButton to AmityWidgetConfig.
Garousi-Developer May 15, 2024
409474c
added widget to custom profile
May 16, 2024
da67fb9
Merge branch 'main' of https://github.com/AmityCo/Amity-Social-UIKit-…
Garousi-Developer May 19, 2024
10e6d19
Merge pull request #20 from arman-garousi-dev/main
ThanakornThanom May 20, 2024
7f782d0
Merge branch 'dev' into Experimental
ThanakornThanom May 20, 2024
72eb560
fix example
ThanakornThanom May 20, 2024
d4ddae6
Merge branch 'dev' into Experimenal' add theme config to community fe…
ThanakornThanom May 21, 2024
6b4bf2c
_
ThanakornThanom May 21, 2024
8398795
Merge branch 'dev' into Experimental
ThanakornThanom May 23, 2024
2264508
Upgrade amity_sdk to version 0.40.0.
Garousi-Developer May 25, 2024
006e3c9
Migrate community feed customization to the v2 file.
Garousi-Developer May 28, 2024
95f2851
Add chat button to ui config.
Garousi-Developer Jun 1, 2024
a287d67
Merge branch 'main' of https://github.com/AmityCo/Amity-Social-UIKit-…
Garousi-Developer Jun 4, 2024
d652ec1
Update user_profile_v2.dart customization
Jun 6, 2024
66d8eef
Fix community feed screen app bar color.
Garousi-Developer Jun 13, 2024
2b658fb
Update user_profile_v2.dart customization
Jun 14, 2024
afc8d3f
Merge branch 'main' of https://github.com/arman-garousi-dev/Amity-Soc…
Jun 14, 2024
9bf3253
Add buildChatButton to configuration viewmodel.
Garousi-Developer Jun 16, 2024
34e08aa
Added metaverse profile
Jun 20, 2024
38dbae5
Added metaverse profile
Jun 20, 2024
497c577
Added customcurrent user avatar
Jun 20, 2024
aa8f847
Added customcurrent user avatar
Jun 20, 2024
986db94
Added Socialrating section
Jun 21, 2024
ffcd197
Migrate show post button from community feed to community feed v2.
Garousi-Developer Jun 21, 2024
01a7b85
Added Socialrating section padding logic
Jun 23, 2024
a6f3599
Added Socialrating section padding logic
Jun 23, 2024
1f1a206
Update moderator logic.
Garousi-Developer Jun 24, 2024
249a1c3
Merge branch 'main' of https://github.com/arman-garousi-dev/Amity-Soc…
Garousi-Developer Jun 24, 2024
f165937
Added customUserProfileNavigate logic
Jun 24, 2024
88c6942
Added customAction padding
Jun 25, 2024
97e33ba
Added onCustomMember, onCustomComment
Jun 28, 2024
b344a3b
Only show communities which allow members to post in post to screen.
Garousi-Developer Jun 28, 2024
0b8da1c
Merge branch 'main' of https://github.com/arman-garousi-dev/Amity-Soc…
Garousi-Developer Jun 28, 2024
9b253be
Merge branch 'main' into metaverse_Profile
jetrinn Jul 1, 2024
fb5ff26
Added onCustomMember, onCustomComment
Jul 1, 2024
21a84f4
Merge remote-tracking branch 'origin/metaverse_Profile' into metavers…
Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
483 changes: 248 additions & 235 deletions example/lib/main.dart

Large diffs are not rendered by default.

59 changes: 31 additions & 28 deletions lib/components/bottom_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:amity_sdk/amity_sdk.dart';
import 'package:amity_uikit_beta_service/components/theme_config.dart';
import 'package:amity_uikit_beta_service/viewmodel/user_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand All @@ -11,35 +12,37 @@ void showOptionsBottomSheet(
backgroundColor: Colors.transparent,
context: context,
builder: (BuildContext bc) {
return Container(
padding: const EdgeInsets.only(top: 20, bottom: 20),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
return ThemeConfig(
child: Container(
padding: const EdgeInsets.only(top: 20, bottom: 20),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
),
),
child: Wrap(
children: [
user.isFlaggedByMe
? ListTile(
title: const Text('Unreport User'),
onTap: () {
Provider.of<UserVM>(context, listen: false)
.reportOrUnReportUser(user);
Navigator.pop(context);
},
)
: ListTile(
title: const Text('Report User'),
onTap: () {
Provider.of<UserVM>(context, listen: false)
.reportOrUnReportUser(user);
Navigator.pop(context);
},
),
],
),
),
child: Wrap(
children: [
user.isFlaggedByMe
? ListTile(
title: const Text('Unreport User'),
onTap: () {
Provider.of<UserVM>(context, listen: false)
.reportOrUnReportUser(user);
Navigator.pop(context);
},
)
: ListTile(
title: const Text('Report User'),
onTap: () {
Provider.of<UserVM>(context, listen: false)
.reportOrUnReportUser(user);
Navigator.pop(context);
},
),
],
),
);
});
Expand Down
16 changes: 13 additions & 3 deletions lib/components/custom_user_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ import '../viewmodel/configuration_viewmodel.dart';

Widget getAvatarImage(String? url, {double? radius = 20, String? fileId}) {
return Builder(builder: (context) {
return CircleAvatar(
return Provider.of<AmityUIConfiguration>(context)
.currentUserImageUrl==true?CircleAvatar(
radius: radius,
backgroundColor:
Provider.of<AmityUIConfiguration>(context).appColors.primaryShade3,
backgroundImage: url != null&&url!='' ? NetworkImage(url) : null,
child: url != null&&url!='' ? const SizedBox()
: Icon(
Icons.person,
color: Colors.white,
size: radius! * 1.5,
)):CircleAvatar(
radius: radius,
backgroundColor:
Provider.of<AmityUIConfiguration>(context).appColors.primaryShade3,
backgroundImage: url != null ? NetworkImage("$url?size=medium") : null,
child: url != null
? const SizedBox()
child: url != null ? const SizedBox()
: Icon(
Icons.person,
color: Colors.white,
Expand Down
13 changes: 11 additions & 2 deletions lib/components/post_profile.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import 'package:amity_sdk/amity_sdk.dart';
import 'package:amity_uikit_beta_service/components/custom_user_avatar.dart';
import 'package:amity_uikit_beta_service/view/UIKit/social/general_component.dart';
import 'package:amity_uikit_beta_service/view/user/user_profile_v2.dart';
import 'package:amity_uikit_beta_service/viewmodel/user_feed_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../viewmodel/configuration_viewmodel.dart';

// Custom Widget that mimics ListTile but without padding
class CustomListTile extends StatelessWidget {
final String? avatarUrl;
Expand All @@ -28,6 +31,9 @@ class CustomListTile extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (userId == AmityCoreClient.getCurrentUser().userId&&Provider.of<AmityUIConfiguration>(context,listen: false).customUserProfileNavigate) {
Provider.of<AmityUIConfiguration>(context,listen: false).onUserProfile(context);
}else{
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) =>
Expand All @@ -37,7 +43,7 @@ class CustomListTile extends StatelessWidget {
amityUser: user,
),
),
));
));}
},
child: Container(
padding: const EdgeInsets.only(bottom: 2, top: 2),
Expand All @@ -46,6 +52,9 @@ class CustomListTile extends StatelessWidget {
children: [
GestureDetector(
onTap: () async {
if (userId == AmityCoreClient.getCurrentUser().userId&&Provider.of<AmityUIConfiguration>(context,listen: false).customUserProfileNavigate) {
Provider.of<AmityUIConfiguration>(context,listen: false).onUserProfile(context);
}else{
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) =>
Expand All @@ -55,7 +64,7 @@ class CustomListTile extends StatelessWidget {
amityUser: user,
),
),
));
));}
},
child: GestureDetector(child: getAvatarImage(avatarUrl)
// If avatarUrl can be null, consider handling it with a placeholder image
Expand Down
43 changes: 43 additions & 0 deletions lib/components/theme_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:amity_uikit_beta_service/viewmodel/configuration_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ThemeConfig extends StatelessWidget {
const ThemeConfig({
super.key,
required this.child,
});

final Widget child;

@override
Widget build(BuildContext context) {
final uiConfig = Provider.of<AmityUIConfiguration>(context);

Widget themeOr(Widget mediaQueryOr) {
if (uiConfig.themeData != null) {
return Theme(
data: uiConfig.themeData!,
child: mediaQueryOr,
);
} else {
return mediaQueryOr;
}
}

Widget mediaQueryOr() {
if (uiConfig.mediaQueryData != null) {
return MediaQuery(
data: uiConfig.mediaQueryData!,
child: child,
);
} else {
return child;
}
}

return themeOr(
mediaQueryOr(),
);
}
}
157 changes: 82 additions & 75 deletions lib/components/video_player.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:amity_sdk/amity_sdk.dart';
import 'package:amity_uikit_beta_service/components/theme_config.dart';
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -149,77 +150,81 @@ class _VideoPlayerScreenState extends State<VideoPlayerScreen> {
? _controllers != null && _controllers!.isNotEmpty
? FullScreenVideoPlayerWidget(
videoPlayerController: _controllers![0])
: Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
: ThemeConfig(
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
onPressed: () => Navigator.of(context).pop(),
),
),
onPressed: () => Navigator.of(context).pop(),
),
),
backgroundColor: Colors.black,
body: const Center(child: CircularProgressIndicator()))
: Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
backgroundColor: Colors.black,
body: const Center(child: CircularProgressIndicator())),
)
: ThemeConfig(
child: Scaffold(
backgroundColor: Colors.black,
title: Text('${_currentIndex + 1}/${widget.files.length}'),
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('${_currentIndex + 1}/${widget.files.length}'),
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
onPressed: () => Navigator.of(context).pop(),
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: _controllers != null && _controllers!.isNotEmpty
? PageView.builder(
controller:
PageController(initialPage: widget.initialIndex),
itemCount: widget.files.length,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
itemBuilder: (context, index) {
var controller = _controllers![index];
var videoData = widget.files[index].data as VideoData;
return GestureDetector(
onTap: () {
_openFullScreenVideo(controller);
},
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
videoData.thumbnail!.fileUrl!),
fit: BoxFit.fitWidth,
body: _controllers != null && _controllers!.isNotEmpty
? PageView.builder(
controller:
PageController(initialPage: widget.initialIndex),
itemCount: widget.files.length,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
itemBuilder: (context, index) {
var controller = _controllers![index];
var videoData = widget.files[index].data as VideoData;
return GestureDetector(
onTap: () {
_openFullScreenVideo(controller);
},
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
videoData.thumbnail!.fileUrl!),
fit: BoxFit.fitWidth,
),
),
),
),
const Align(
alignment: Alignment.center,
child: Icon(
Icons.play_arrow,
size: 70.0,
color: Colors.white,
const Align(
alignment: Alignment.center,
child: Icon(
Icons.play_arrow,
size: 70.0,
color: Colors.white,
),
),
),
],
],
),
),
),
);
},
)
: const Center(child: CircularProgressIndicator()),
);
},
)
: const Center(child: CircularProgressIndicator()),
),
);
}
}
Expand Down Expand Up @@ -259,21 +264,23 @@ class _FullScreenVideoPlayerWidgetState
minChildSize: 0.5,
initialChildSize: 1.0,
builder: (BuildContext context, ScrollController scrollController) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
return ThemeConfig(
child: Scaffold(
backgroundColor: Colors.black,
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
appBar: AppBar(
backgroundColor: Colors.black,
leading: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
onPressed: () => Navigator.of(context).pop(),
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: SafeArea(
child: Chewie(
controller: _chewieController,
body: SafeArea(
child: Chewie(
controller: _chewieController,
),
),
),
);
Expand Down
Loading