UI nit picks

This commit is contained in:
xsahil03x
2020-11-20 12:06:00 +05:30
parent 822547b644
commit 389656a477
4 changed files with 124 additions and 76 deletions
+21 -23
View File
@@ -64,24 +64,20 @@ class ChipInputTextFieldState<T> extends State<ChipsInputTextField<T>> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
elevation: 4, elevation: 1,
color: Colors.white, color: Colors.white,
child: Container( child: Container(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
vertical: 16.0,
horizontal: 16.0,
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0), padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Text( child: Text(
'TO:', 'TO:',
style: TextStyle( style: TextStyle(
fontSize: 16, color: Colors.black.withOpacity(0.5),
fontWeight: FontWeight.w500,
), ),
), ),
), ),
@@ -92,46 +88,48 @@ class ChipInputTextFieldState<T> extends State<ChipsInputTextField<T>> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Wrap( Wrap(
spacing: 4.0, spacing: 8.0,
runSpacing: 4.0, runSpacing: 4.0,
children: _chips.map((item) { children: _chips.map((item) {
return widget.chipBuilder(context, item); return widget.chipBuilder(context, item);
}).toList(), }).toList(),
), ),
if (!_pauseItemAddition) ...[ if (!_pauseItemAddition) ...[
if (_chips.isNotEmpty) SizedBox(height: 4),
TextField( TextField(
controller: widget.controller, controller: widget.controller,
onChanged: widget.onInputChanged, onChanged: widget.onInputChanged,
focusNode: widget.focusNode, focusNode: widget.focusNode,
style: TextStyle(fontSize: 18),
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
errorBorder: InputBorder.none, errorBorder: InputBorder.none,
disabledBorder: InputBorder.none, disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.only(top: 4.0),
vertical: 8, hintText: widget.hint,
), ),
hintText: widget.hint,
hintStyle: TextStyle(fontSize: 18)),
), ),
] ]
], ],
), ),
), ),
SizedBox(width: 12),
IconButton( IconButton(
icon: Icon( icon: Icon(
_chips.isEmpty ? StreamIcons.user : StreamIcons.user_add, _chips.isEmpty ? StreamIcons.user : StreamIcons.user_add,
color: Colors.black.withOpacity(0.5),
), ),
onPressed: () { onPressed: () {
resumeItemAddition(); resumeItemAddition();
}, },
alignment: Alignment.topRight,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
splashRadius: 24,
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
), ),
], ],
), ),
+83 -42
View File
@@ -312,10 +312,12 @@ class _NewChatScreenState extends State<NewChatScreen> {
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
backgroundColor: Colors.white, backgroundColor: Colors.white,
leading: const StreamBackButton(),
title: Text( title: Text(
'New Chat', 'New Chat',
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
centerTitle: true,
), ),
body: StreamChannel( body: StreamChannel(
showLoading: false, showLoading: false,
@@ -329,17 +331,31 @@ class _NewChatScreenState extends State<NewChatScreen> {
controller: _controller, controller: _controller,
focusNode: FocusNode(), focusNode: FocusNode(),
chipBuilder: (context, user) { chipBuilder: (context, user) {
return InputChip( return Stack(
key: ObjectKey(user), alignment: AlignmentDirectional.centerStart,
label: Text( children: [
user.name, Container(
style: TextStyle(color: Colors.black), decoration: BoxDecoration(
), color: Colors.black.withOpacity(0.05),
avatar: UserAvatar( borderRadius: BorderRadius.circular(12),
user: user, ),
), padding: const EdgeInsets.only(left: 24),
onDeleted: () => _chipInputTextFieldState.removeItem(user), child: Padding(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, padding: const EdgeInsets.fromLTRB(8, 4, 12, 4),
child: Text(
user.name,
style: TextStyle(color: Colors.black),
),
),
),
UserAvatar(
user: user,
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
),
],
); );
}, },
onChipAdded: (user) { onChipAdded: (user) {
@@ -381,7 +397,17 @@ class _NewChatScreenState extends State<NewChatScreen> {
), ),
Container( Container(
width: double.maxFinite, width: double.maxFinite,
color: Colors.grey.shade50, decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.black.withOpacity(0.02),
Colors.white.withOpacity(0.05),
],
stops: [0, 1],
),
),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 8, vertical: 8,
@@ -392,7 +418,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
? "Matches for \"$_userNameQuery\"" ? "Matches for \"$_userNameQuery\""
: 'On the platform', : 'On the platform',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, color: Colors.black.withOpacity(0.5),
), ),
), ),
), ),
@@ -516,12 +542,14 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 2, elevation: 1,
backgroundColor: Colors.white, backgroundColor: Colors.white,
leading: const StreamBackButton(),
title: Text( title: Text(
'Add Group Members', 'Add Group Members',
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
centerTitle: true,
actions: [ actions: [
if (_selectedUsers.isNotEmpty) if (_selectedUsers.isNotEmpty)
IconButton( IconButton(
@@ -546,6 +574,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
child: Column( child: Column(
children: [ children: [
Container( Container(
height: 36,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.grey.shade300, color: Colors.grey.shade300,
@@ -559,9 +588,13 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
child: TextField( child: TextField(
controller: _controller, controller: _controller,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon(StreamIcons.search), prefixIcon: Icon(
StreamIcons.search,
color: Colors.black,
),
hintText: 'Search', hintText: 'Search',
contentPadding: const EdgeInsets.all(8), contentPadding: const EdgeInsets.all(0),
// isDense: true,
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
@@ -571,7 +604,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
), ),
if (_selectedUsers.isNotEmpty) if (_selectedUsers.isNotEmpty)
Container( Container(
height: 120, height: 104,
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: _selectedUsers.length, itemCount: _selectedUsers.length,
@@ -586,10 +619,10 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
UserAvatar( UserAvatar(
user: user, user: user,
showOnlineStatus: true, showOnlineStatus: true,
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(32),
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: 80, height: 64,
width: 80, width: 64,
), ),
), ),
Positioned( Positioned(
@@ -609,10 +642,10 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
Border.all(color: Colors.grey.shade100), Border.all(color: Colors.grey.shade100),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(2.0),
child: Icon( child: Icon(
Icons.clear_rounded, Icons.clear_rounded,
size: 16, size: 14,
), ),
), ),
), ),
@@ -624,8 +657,8 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
Text( Text(
user.name.split(' ')[0], user.name.split(' ')[0],
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.bold,
fontSize: 16, fontSize: 12,
), ),
), ),
], ],
@@ -635,7 +668,17 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
), ),
Container( Container(
width: double.maxFinite, width: double.maxFinite,
color: Colors.grey.shade50, decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.black.withOpacity(0.02),
Colors.white.withOpacity(0.05),
],
stops: [0, 1],
),
),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 8, vertical: 8,
@@ -646,7 +689,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
? 'Matches for \"$_userNameQuery\"' ? 'Matches for \"$_userNameQuery\"'
: 'On the platform', : 'On the platform',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, color: Colors.black.withOpacity(0.5),
), ),
), ),
), ),
@@ -755,42 +798,40 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 2, elevation: 1,
backgroundColor: Colors.white, backgroundColor: Colors.white,
leading: const StreamBackButton(),
title: Text( title: Text(
'Name of Group Chat', 'Name of Group Chat',
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
centerTitle: true,
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size.fromHeight(kToolbarHeight), preferredSize: Size.fromHeight(kToolbarHeight),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 16),
child: Row( child: Row(
children: [ children: [
Text( Text(
'NAME', 'NAME',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, color: Colors.black.withOpacity(0.5),
fontSize: 16,
), ),
), ),
SizedBox(width: 16), SizedBox(width: 16),
Expanded( Expanded(
child: TextField( child: TextField(
controller: _groupNameController, controller: _groupNameController,
style: TextStyle(fontSize: 18),
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
errorBorder: InputBorder.none, errorBorder: InputBorder.none,
disabledBorder: InputBorder.none, disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.all(0),
vertical: 8, hintText: 'Choose a group chat name',
), ),
hintText: 'Choose a group chat name',
hintStyle: TextStyle(fontSize: 18)),
), ),
), ),
], ],
+13 -8
View File
@@ -59,13 +59,18 @@ class UserItem extends StatelessWidget {
} }
}, },
leading: UserAvatar( leading: UserAvatar(
user: user, user: user,
showOnlineStatus: true, showOnlineStatus: true,
onTap: (user) { onTap: (user) {
if (onImageTap != null) { if (onImageTap != null) {
onImageTap(user); onImageTap(user);
} }
}), },
constraints: BoxConstraints.tightFor(
height: 40,
width: 40,
),
),
trailing: selected trailing: selected
? CircleAvatar( ? CircleAvatar(
child: Icon( child: Icon(
@@ -75,7 +80,7 @@ class UserItem extends StatelessWidget {
radius: 10, radius: 10,
) )
: null, : null,
title: Text(user.name), title: Text(user.name,style: TextStyle(fontWeight: FontWeight.bold),),
subtitle: showLastSeen ? _buildLastActive(context) : null, subtitle: showLastSeen ? _buildLastActive(context) : null,
); );
} }
+7 -3
View File
@@ -376,12 +376,16 @@ class _UserListViewState extends State<UserListView>
headerItem: (header) { headerItem: (header) {
return Container( return Container(
key: ValueKey<String>('HEADER-$header'), key: ValueKey<String>('HEADER-$header'),
color: Colors.grey.shade100, color: Colors.black.withOpacity(0.05),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.symmetric(horizontal:8.0,vertical: 6),
child: Text( child: Text(
header, header,
style: TextStyle(fontWeight: FontWeight.w500), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
color:Colors.black.withOpacity(0.3)
),
), ),
), ),
); );