feat: implementing group info view
parent
b4849b7c2d
commit
d00a484541
|
@ -3,6 +3,9 @@ import "package:flutter/material.dart";
|
|||
import "./widgets/home_view.dart";
|
||||
import "./widgets/new_conversation_view.dart";
|
||||
import "./widgets/new_group_view.dart";
|
||||
import "./widgets/new_group_info_view.dart";
|
||||
|
||||
import "../../models/user_model.dart";
|
||||
|
||||
class ConversationTab extends StatefulWidget {
|
||||
@override
|
||||
|
@ -25,9 +28,13 @@ class _ConversationTabState extends State<ConversationTab> {
|
|||
case "conversation/new":
|
||||
builder = (BuildContext _) => NewConversationView();
|
||||
break;
|
||||
case "conversation/group/new":
|
||||
case "conversation/new/group":
|
||||
builder = (BuildContext _) => NewGroupView();
|
||||
break;
|
||||
case "conversation/new/groupinfo":
|
||||
final List<User> users = settings.arguments;
|
||||
builder = (BuildContext _) => NewGroupInfoView(users: users);
|
||||
break;
|
||||
default:
|
||||
throw Exception("Invalid route: ${settings.name}");
|
||||
}
|
||||
|
|
|
@ -131,11 +131,12 @@ class _NewConversationViewState extends State<NewConversationView> {
|
|||
controller: searchController, hintText: "Search for people"),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, "conversation/group/new");
|
||||
Navigator.pushNamed(context, "conversation/new/group");
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Row(children: <Widget>[
|
||||
child:
|
||||
Row(mainAxisSize: MainAxisSize.max, children: <Widget>[
|
||||
Icon(Icons.group_add,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
size: 30.0),
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
import "../../../models/user_model.dart";
|
||||
|
||||
import "../../widgets/contact_item.dart";
|
||||
import "../../widgets/top_bar.dart";
|
||||
import "../../widgets/small_text_button.dart";
|
||||
|
||||
class NewGroupInfoView extends StatefulWidget {
|
||||
final List<User> users;
|
||||
|
||||
NewGroupInfoView({@required this.users});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _NewGroupInfoViewState();
|
||||
}
|
||||
}
|
||||
|
||||
class _NewGroupInfoViewState extends State<NewGroupInfoView> {
|
||||
final descriptionController = TextEditingController();
|
||||
final nameController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
descriptionController.dispose();
|
||||
nameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[
|
||||
TopBar(title: "New Group", children: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
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]))),
|
||||
])),
|
||||
]),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 20.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.users
|
||||
.map((user) => ContactItem(user: user))
|
||||
.toList())))
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -19,6 +19,8 @@ class NewGroupView extends StatefulWidget {
|
|||
class _NewGroupViewState extends State<NewGroupView> {
|
||||
final searchController = TextEditingController();
|
||||
|
||||
List<User> selectedUsers = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -41,7 +43,12 @@ class _NewGroupViewState extends State<NewGroupView> {
|
|||
Navigator.pop(context);
|
||||
}),
|
||||
Spacer(),
|
||||
SmallTextButton(text: "Next", onClickCallback: () {})
|
||||
SmallTextButton(
|
||||
text: "Next",
|
||||
onClickCallback: () {
|
||||
Navigator.pushNamed(context, "conversation/new/groupinfo",
|
||||
arguments: selectedUsers);
|
||||
})
|
||||
]),
|
||||
Expanded(
|
||||
child: StreamBuilder(
|
||||
|
@ -122,7 +129,9 @@ class _NewGroupViewState extends State<NewGroupView> {
|
|||
return ContactItem(
|
||||
user: entry.value[index],
|
||||
selectable: true,
|
||||
onClickCallback: (state) {});
|
||||
onClickCallback: (state) {
|
||||
selectedUsers.add(entry.value[index]);
|
||||
});
|
||||
}))
|
||||
]);
|
||||
}).toList();
|
||||
|
|
Loading…
Reference in New Issue