Skip to content

Commit

Permalink
feat: create groups screen for mobile version
Browse files Browse the repository at this point in the history
  • Loading branch information
sonle-geekyants committed Mar 19, 2024
1 parent 45980d7 commit 8d6cf16
Show file tree
Hide file tree
Showing 20 changed files with 1,141 additions and 93 deletions.
1 change: 1 addition & 0 deletions assets/svg/ic_pencil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/ic_trust_deactivated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DesktopCoverImagePicker extends StatelessWidget {
),
)
: Container(
padding: const EdgeInsets.fromLTRB(108, 12, 108, 16),
padding: const EdgeInsets.only(top: 12, bottom: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: ColorConstants.pickerBackgroundColor,
Expand All @@ -104,7 +104,6 @@ class DesktopCoverImagePicker extends StatelessWidget {
AppVectors.icDesktopImage,
width: 48,
height: 32,
fit: BoxFit.fitWidth,
),
],
),
Expand Down
114 changes: 114 additions & 0 deletions lib/screens/common_widgets/cover_image_picker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import 'dart:typed_data';

import 'package:atsign_atmosphere_pro/utils/colors.dart';
import 'package:atsign_atmosphere_pro/utils/images.dart';
import 'package:atsign_atmosphere_pro/utils/text_styles.dart';
import 'package:atsign_atmosphere_pro/utils/vectors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class CoverImagePicker extends StatelessWidget {
final Function() onTap;
final Uint8List? groupImage;
final double height;
final EdgeInsetsGeometry margin;
final bool showOptions;
final Function()? onCancel;

const CoverImagePicker({
required this.onTap,
required this.groupImage,
required this.height,
this.margin = const EdgeInsets.symmetric(horizontal: 28),
this.showOptions = false,
this.onCancel,
});

@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
height: height,
width: double.infinity,
margin: margin,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: ColorConstants.dividerContextMenuColor,
),
child: Stack(
fit: StackFit.expand,
children: [
groupImage != null
? ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.memory(
groupImage!,
fit: BoxFit.cover,
),
)
: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Insert Cover Image",
style: CustomTextStyles.greyW50014,
),
SizedBox(height: 8),
Image.asset(
ImageConstants.icImage,
width: 48,
height: 32,
),
],
),
if (showOptions)
Positioned(
top: 12,
right: 12,
left: 12,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: onCancel,
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white54.withOpacity(0.5),
),
child: SvgPicture.asset(
AppVectors.icCancel,
width: 16,
height: 16,
color: Colors.black,
fit: BoxFit.cover,
),
),
),
if (groupImage != null)
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white54.withOpacity(0.5),
),
child: SvgPicture.asset(
AppVectors.icEdit,
width: 16,
height: 16,
fit: BoxFit.cover,
),
),
],
),
),
],
),
),
);
}
}
69 changes: 31 additions & 38 deletions lib/screens/contact_new_version/contact_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,46 +156,39 @@ class _ContactDetailScreenState extends State<ContactDetailScreen> {
SizedBox(height: 4),
Flexible(
child: isEditNickname
? Row(
children: [
Flexible(
child: TextField(
maxLines: 1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: 16,
),
hintText: 'Enter Nickname',
hintStyle: TextStyle(
fontSize: 14.toFont,
fontWeight: FontWeight.w500,
color: ColorConstants.textBlack,
),
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(5),
borderSide: BorderSide.none,
),
labelStyle: TextStyle(
fontSize: 14.toFont,
),
fillColor: Colors.white,
filled: true,
suffixIcon: InkWell(
onTap: () {
nicknameController.clear();
},
child: Icon(
Icons.clear,
color: Colors.black,
size: 16,
),
),
),
controller: nicknameController,
? TextField(
maxLines: 1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: 16,
),
hintText: 'Enter Nickname',
hintStyle: TextStyle(
fontSize: 14.toFont,
fontWeight: FontWeight.w500,
color: ColorConstants.textBlack,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide.none,
),
labelStyle: TextStyle(
fontSize: 14.toFont,
),
fillColor: Colors.white,
filled: true,
suffixIcon: InkWell(
onTap: () {
nicknameController.clear();
},
child: Icon(
Icons.clear,
color: Colors.black,
size: 16,
),
),
],
),
controller: nicknameController,
)
: Text(
widget.contact.tags?['nickname'] ??
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/contact_new_version/contact_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:at_common_flutter/services/size_config.dart';
import 'package:at_contacts_group_flutter/screens/group_view/group_view.dart';
import 'package:at_contacts_group_flutter/services/group_service.dart';
import 'package:atsign_atmosphere_pro/data_models/enums/contact_type.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/app_bar_custom.dart';
Expand All @@ -10,6 +9,7 @@ import 'package:atsign_atmosphere_pro/screens/contact_new_version/contact_detail
import 'package:atsign_atmosphere_pro/screens/contact_new_version/create_group_screen.dart';
import 'package:atsign_atmosphere_pro/screens/contact_new_version/widget/contact_skeleton_loading_widget.dart';
import 'package:atsign_atmosphere_pro/screens/contact_new_version/widget/list_contact_widget.dart';
import 'package:atsign_atmosphere_pro/screens/group_contacts/group_contacts_screen.dart';
import 'package:atsign_atmosphere_pro/utils/colors.dart';
import 'package:atsign_atmosphere_pro/view_models/contact_provider.dart';
import 'package:atsign_atmosphere_pro/view_models/create_group_provider.dart';
Expand Down Expand Up @@ -274,7 +274,7 @@ class _ContactScreenState extends State<ContactScreen>
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GroupView(
builder: (context) => GroupContactsScreen(
group: group,
),
),
Expand Down
56 changes: 9 additions & 47 deletions lib/screens/contact_new_version/create_group_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import 'package:at_common_flutter/at_common_flutter.dart';
import 'package:at_commons/at_commons.dart';
import 'package:at_contact/at_contact.dart';
import 'package:at_contacts_group_flutter/at_contacts_group_flutter.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/cover_image_picker.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_toast.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/input_widget.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/search_widget.dart';
import 'package:atsign_atmosphere_pro/screens/contact_new_version/widget/list_contact_widget.dart';
import 'package:atsign_atmosphere_pro/utils/colors.dart';
import 'package:atsign_atmosphere_pro/utils/images.dart';
import 'package:atsign_atmosphere_pro/utils/text_strings.dart';
import 'package:atsign_atmosphere_pro/utils/vectors.dart';
import 'package:atsign_atmosphere_pro/view_models/create_group_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -115,7 +114,14 @@ class _CreateGroupScreenState extends State<CreateGroupScreen> {
},
),
),
_buildImage(value.selectedImageByteData),
SizedBox(height: 16),
CoverImagePicker(
onTap: () async {
await _provider.selectCoverImage();
},
groupImage: value.selectedImageByteData,
height: 88,
),
Padding(
padding: const EdgeInsets.only(
top: 22,
Expand Down Expand Up @@ -254,48 +260,4 @@ class _CreateGroupScreenState extends State<CreateGroupScreen> {
);
});
}

Widget _buildImage(Uint8List? selectedImage) {
return InkWell(
onTap: () async {
await _provider.selectCoverImage();
},
child: Container(
height: 89,
width: double.infinity,
margin: const EdgeInsets.fromLTRB(27, 14, 27, 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xFFECECEC),
),
child: selectedImage != null
? ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.memory(
selectedImage,
fit: BoxFit.cover,
),
)
: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"Insert Cover Image",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: ColorConstants.grey,
),
),
SizedBox(height: 8),
Image.asset(
ImageConstants.icImage,
),
],
),
),
),
);
}
}
Loading

0 comments on commit 8d6cf16

Please sign in to comment.