4
2
Fork 0

feat: added group create and profile picture picker

pull/54/head
Sudharshan S. 2019-06-29 10:52:00 +08:00
parent acc2e8187d
commit c8cdbd34e9
Signed by: sudharshan
GPG Key ID: C861C97AAF3D9559
5 changed files with 95 additions and 49 deletions

View File

@ -283,7 +283,7 @@
"${PODS_ROOT}/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework",
"${BUILT_PRODUCTS_DIR}/Just/Just.framework",
"${BUILT_PRODUCTS_DIR}/PercentEncoder/PercentEncoder.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/image_picker_modern/image_picker_modern.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
);
@ -294,7 +294,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Just.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PercentEncoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker_modern.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
);

View File

@ -46,9 +46,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSPhotoLibraryAddUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>
<string>Profile/Group picture</string>
<key> Privacy - Camera Usage Description</key>
<key>NSCameraUsageDescription</key>
<string>Selfie for profile/group picture</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>

View File

@ -1,10 +1,13 @@
import "package:flutter/material.dart";
import 'package:image_picker_modern/image_picker_modern.dart';
import "dart:io";
import "../../../models/user_model.dart";
import "../../widgets/contact_item.dart";
import "../../widgets/top_bar.dart";
import "../../widgets/small_text_button.dart";
import "../../widgets/list_button.dart";
class NewGroupInfoView extends StatefulWidget {
final List<User> users;
@ -21,6 +24,8 @@ class _NewGroupInfoViewState extends State<NewGroupInfoView> {
final descriptionController = TextEditingController();
final nameController = TextEditingController();
File _image;
@override
void dispose() {
descriptionController.dispose();
@ -40,50 +45,87 @@ class _NewGroupInfoViewState extends State<NewGroupInfoView> {
Spacer(),
SmallTextButton(text: "Create", onClickCallback: () {})
]),
Row(crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[
Container(
height: 70.0,
width: 70.0,
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.all(Radius.circular(35.0)))),
Flexible(
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
TextField(
controller: nameController,
autocorrect: false,
cursorWidth: 2.0,
cursorColor: Colors.grey[500],
style: Theme.of(context).textTheme.subtitle.copyWith(
color: Colors.grey[500], fontWeight: FontWeight.w300),
decoration: InputDecoration(
border: InputBorder.none,
filled: false,
hintText: "Enter group name",
hintStyle: Theme.of(context)
.textTheme
.subtitle
.copyWith(color: Colors.grey[500]))),
TextField(
controller: descriptionController,
autocorrect: false,
cursorWidth: 2.0,
cursorColor: Colors.grey[500],
style: Theme.of(context).textTheme.subtitle.copyWith(
color: Colors.grey[500], fontWeight: FontWeight.w300),
decoration: InputDecoration(
border: InputBorder.none,
filled: false,
hintText: "Enter group description",
hintStyle: Theme.of(context)
.textTheme
.subtitle
.copyWith(color: Colors.grey[500]))),
])),
]),
Padding(
padding: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: <
Widget>[
Container(
height: 100.0,
width: 100.0,
decoration: (_image == null)
? (BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.all(Radius.circular(50.0))))
: BoxDecoration(
image: DecorationImage(
image: FileImage(_image),
fit: BoxFit.cover,
))),
Flexible(
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
Container(
margin: EdgeInsets.only(left: 8.0),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
color: Colors.grey[100],
child: TextField(
controller: nameController,
autocorrect: false,
cursorWidth: 2.0,
cursorColor: Colors.grey[500],
style: Theme.of(context).textTheme.subtitle.copyWith(
color: Colors.grey[500], fontWeight: FontWeight.w300),
decoration: InputDecoration(
border: InputBorder.none,
filled: false,
hintText: "Enter group name",
hintStyle: Theme.of(context)
.textTheme
.subtitle
.copyWith(color: Colors.grey[500])))),
Container(
margin: EdgeInsets.only(left: 8.0, top: 5.0),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.grey[100],
),
child: TextField(
controller: descriptionController,
autocorrect: false,
maxLines: 3,
cursorWidth: 2.0,
cursorColor: Colors.grey[500],
style: Theme.of(context).textTheme.subtitle.copyWith(
color: Colors.grey[500],
fontWeight: FontWeight.w300,
),
decoration: InputDecoration(
border: InputBorder.none,
filled: false,
hintText: "Enter group description",
hintStyle: Theme.of(context)
.textTheme
.subtitle
.copyWith(color: Colors.grey[500])))),
])),
])),
Padding(
padding: EdgeInsets.only(top: 10.0),
child: ListButton(
icon: Icons.insert_photo,
text: "Add a group photo",
onClickCallback: () async {
var image =
await ImagePicker.pickImage(source: ImageSource.camera);
setState(() {
_image = image;
});
})),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: 20.0),
padding: EdgeInsets.only(top: 0.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: widget.users

View File

@ -49,8 +49,12 @@ class _NewGroupViewState extends State<NewGroupView> {
SmallTextButton(
text: "Next",
onClickCallback: () {
Navigator.pushNamed(context, "conversation/new/groupinfo",
arguments: selectedUsers);
if (selectedUsers.length <= 1) {
return;
} else {
Navigator.pushNamed(context, "conversation/new/groupinfo",
arguments: selectedUsers);
}
})
],
search: SearchInput(

View File

@ -17,7 +17,7 @@ dependencies:
sqflite: ^1.1.0
eventsource: ^0.2.1
sticky_headers: ^0.1.7
image_picker: ^0.6.0+10
image_picker_modern: ^0.4.12+2
dev_dependencies:
flutter_test: