feat: adding selectable contacts
parent
56eaaad190
commit
6bc3b4ad85
|
@ -283,6 +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}/shared_preferences/shared_preferences.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
|
||||
);
|
||||
|
@ -293,6 +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}/shared_preferences.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
|
||||
);
|
||||
|
|
|
@ -7,6 +7,7 @@ import "../../../blocs/contact_bloc.dart";
|
|||
import "../../widgets/contact_item.dart";
|
||||
import "../../widgets/top_bar.dart";
|
||||
import "../../widgets/search_input.dart";
|
||||
import "../../widgets/small_text_button.dart";
|
||||
|
||||
class HomeView extends StatefulWidget {
|
||||
@override
|
||||
|
@ -34,13 +35,11 @@ class _HomeViewState extends State<HomeView> {
|
|||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[
|
||||
TopBar(title: "Contacts", children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 13.0),
|
||||
child: Text("Edit",
|
||||
style: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.copyWith(fontWeight: FontWeight.w300))),
|
||||
SmallTextButton(
|
||||
text: "Edit",
|
||||
onClickCallback: () {
|
||||
print("hello");
|
||||
}),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add),
|
||||
|
|
|
@ -6,6 +6,7 @@ import "../../../blocs/conversation_bloc.dart";
|
|||
import "../../widgets/conversation_item.dart";
|
||||
import "../../widgets/top_bar.dart";
|
||||
import "../../widgets/search_input.dart";
|
||||
import "../../widgets/small_text_button.dart";
|
||||
|
||||
class HomeView extends StatefulWidget {
|
||||
@override
|
||||
|
@ -33,13 +34,11 @@ class _HomeViewState extends State<HomeView> {
|
|||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[
|
||||
TopBar(title: "Conversations", children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 13.0),
|
||||
child: Text("Edit",
|
||||
style: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.copyWith(fontWeight: FontWeight.w300))),
|
||||
SmallTextButton(
|
||||
text: "Edit",
|
||||
onClickCallback: () {
|
||||
print("hello");
|
||||
}),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_comment),
|
||||
|
|
|
@ -7,6 +7,7 @@ import "../../../blocs/contact_bloc.dart";
|
|||
import "../../widgets/contact_item.dart";
|
||||
import "../../widgets/top_bar.dart";
|
||||
import "../../widgets/search_input.dart";
|
||||
import "../../widgets/small_text_button.dart";
|
||||
|
||||
class NewConversationView extends StatefulWidget {
|
||||
@override
|
||||
|
@ -40,13 +41,7 @@ class _NewConversationViewState extends State<NewConversationView> {
|
|||
Navigator.pop(context);
|
||||
}),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 13.0),
|
||||
child: Text("Next",
|
||||
style: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.copyWith(fontWeight: FontWeight.w300))),
|
||||
SmallTextButton(text: "Next", onClickCallback: () {})
|
||||
]),
|
||||
Expanded(
|
||||
child: StreamBuilder(
|
||||
|
|
|
@ -3,38 +3,76 @@ import "package:flutter/material.dart";
|
|||
import "../../models/user_model.dart";
|
||||
import "../widgets/user_avatar.dart";
|
||||
|
||||
class ContactItem extends StatelessWidget {
|
||||
final User user;
|
||||
typedef void OnClickCallback(bool state);
|
||||
|
||||
ContactItem({@required this.user});
|
||||
class ContactItem extends StatefulWidget {
|
||||
final User user;
|
||||
final bool selectable;
|
||||
final OnClickCallback onClickCallback;
|
||||
|
||||
ContactItem(
|
||||
{@required this.user, this.onClickCallback, this.selectable: false});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ContactItemState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ContactItemState extends State<ContactItem> {
|
||||
bool selected = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
UserAvatar(
|
||||
user: user,
|
||||
radius: 18.0,
|
||||
padding: EdgeInsets.only(left: 15.0)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(user.firstName + " " + user.lastName,
|
||||
style: Theme.of(context).textTheme.title,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 2),
|
||||
child: Text("Last seen x ago",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.subtitle
|
||||
.copyWith(color: Color(0xFF455A64)))),
|
||||
]))
|
||||
]));
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
elevation: 1,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
if (widget.selectable == true) {
|
||||
setState(() {
|
||||
selected = !selected;
|
||||
});
|
||||
|
||||
widget.onClickCallback(selected);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
(widget.selectable)
|
||||
? Checkbox(
|
||||
value: selected,
|
||||
activeColor: Theme.of(context).primaryColorDark,
|
||||
onChanged: (state) {})
|
||||
: Container(),
|
||||
UserAvatar(
|
||||
user: widget.user,
|
||||
radius: 18.0,
|
||||
padding: EdgeInsets.only(
|
||||
left: ((widget.selectable) ? 0 : 15.0))),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.user.firstName +
|
||||
" " +
|
||||
widget.user.lastName,
|
||||
style: Theme.of(context).textTheme.title,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 2),
|
||||
child: Text("Last seen x ago",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.subtitle
|
||||
.copyWith(
|
||||
color: Color(0xFF455A64)))),
|
||||
]))
|
||||
]))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
typedef void OnClickCallback();
|
||||
|
||||
class SmallTextButton extends StatelessWidget {
|
||||
final String text;
|
||||
final OnClickCallback onClickCallback;
|
||||
|
||||
SmallTextButton({@required this.text, @required this.onClickCallback});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
elevation: 1,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: GestureDetector(
|
||||
onTap: onClickCallback,
|
||||
child: Text(text,
|
||||
style: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.copyWith(fontWeight: FontWeight.w300)))));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue