minor fixes

This commit is contained in:
Salvatore Giordano
2020-11-18 10:49:35 +01:00
parent 0d7bf98a5b
commit d379de9f96
7 changed files with 471 additions and 393 deletions
+1 -1
View File
@@ -1 +1 @@
bb5f9103d9045cd6244bcae1f5f343e5
c3e639ccf9b069e37a7d1345194e6b99
+3
View File
@@ -94,6 +94,8 @@ class ChooseUserPage extends StatelessWidget {
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 32),
child: ListView.separated(
separatorBuilder: (context, i) {
return Container(
@@ -217,6 +219,7 @@ class ChooseUserPage extends StatelessWidget {
},
),
),
),
StreamVersion(),
],
),
+46 -29
View File
@@ -21,7 +21,7 @@ void main() async {
logLevel: Level.INFO,
showLocalNotification:
(!kIsWeb && Platform.isAndroid) ? showLocalNotification : null,
persistenceEnabled: false,
persistenceEnabled: true,
);
if (userId != null) {
@@ -43,6 +43,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
//TODO change to system once dark theme is implemented
@@ -63,7 +64,45 @@ class ChannelListPage extends StatelessWidget {
Widget build(BuildContext context) {
final user = StreamChat.of(context).user;
return Scaffold(
drawer: Drawer(
drawerEnableOpenDragGesture: true,
drawerEdgeDragWidth: 50,
drawer: _buildDrawer(context, user),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return CreateChannelPage();
}));
},
),
body: ChannelsBloc(
child: ChannelListView(
onStartChatPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return CreateChannelPage();
}));
},
swipeToAction: true,
filter: {
'members': {
'\$in': [user.id],
}
},
options: {
'presence': true,
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
channelWidget: ChannelPage(),
),
),
);
}
Drawer _buildDrawer(BuildContext context, User user) {
return Drawer(
child: SafeArea(
child: Padding(
padding: EdgeInsets.only(
@@ -145,33 +184,6 @@ class ChannelListPage extends StatelessWidget {
),
),
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return CreateChannelPage();
}));
},
),
body: ChannelsBloc(
child: ChannelListView(
swipeToAction: true,
filter: {
'members': {
'\$in': [user.id],
}
},
options: {
'presence': true,
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
channelWidget: ChannelPage(),
),
),
);
}
}
@@ -418,6 +430,11 @@ class _CreateChannelPageState extends State<CreateChannelPage> {
limit: 25,
offset: offset,
),
filter: {
'id': {
r'$ne': client.state.user.id,
}
},
sort: [
SortOption(
'name',
+1 -1
View File
@@ -1,6 +1,6 @@
name: example
description: A new Flutter project.
version: 1.0.60+62
version: 1.0.62+64
environment:
sdk: ">=2.2.2 <3.0.0"
+69 -7
View File
@@ -70,6 +70,7 @@ class ChannelListView extends StatefulWidget {
this.errorBuilder,
this.emptyBuilder,
this.onImageTap,
this.onStartChatPressed,
this.swipeToAction = false,
this.pullToRefresh = true,
}) : super(key: key);
@@ -129,6 +130,9 @@ class ChannelListView extends StatefulWidget {
/// Set it to false to disable the pull-to-refresh widget
final bool pullToRefresh;
/// Callback used in the default empty list widget
final VoidCallback onStartChatPressed;
@override
_ChannelListViewState createState() => _ChannelListViewState();
}
@@ -185,14 +189,70 @@ class _ChannelListViewState extends State<ChannelListView>
builder: (context, viewportConstraints) {
return SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
child: ConstrainedBox(
child: Stack(
children: [
ConstrainedBox(
constraints: BoxConstraints(
minHeight: viewportConstraints.maxHeight,
),
child: Center(
child: Text('You have no channels currently'),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
StreamIcons.message,
size: 136,
color: Color(0xffDBDBDB),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Lets start chatting!',
style: TextStyle(
fontSize: 16,
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 52,
),
child: Text(
'How about sending your first message to a friend?',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Color(0xff7A7A7A),
),
),
),
],
),
),
if (widget.onStartChatPressed != null)
Positioned(
right: 0,
left: 0,
bottom: 32,
child: Center(
child: FlatButton(
onPressed: widget.onStartChatPressed,
child: Text(
'Start a chat',
style: TextStyle(
color:
StreamChatTheme.of(context).accentColor,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
);
},
);
@@ -542,10 +602,12 @@ class _ChannelListViewState extends State<ChannelListView>
),
);
}
return snapshot.data
? _buildLoadingItem()
: Container(
height: 70,
return Container(
height: 100,
padding: EdgeInsets.all(32),
child: Center(
child: snapshot.data ? CircularProgressIndicator() : Container(),
),
);
});
}
+3 -8
View File
@@ -41,9 +41,7 @@ class GiphyAttachment extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
DecoratedBox(
decoration: BoxDecoration(),
child: Card(
Card(
elevation: 2,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
@@ -64,8 +62,7 @@ class GiphyAttachment extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (_) {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return FullScreenImage(
url: attachment.imageUrl ??
attachment.assetUrl ??
@@ -122,8 +119,7 @@ class GiphyAttachment extends StatelessWidget {
Text(
'GIPHY',
style: TextStyle(
color:
StreamChatTheme.of(context).accentColor,
color: StreamChatTheme.of(context).accentColor,
fontWeight: FontWeight.bold,
fontSize: 11.0,
),
@@ -247,7 +243,6 @@ class GiphyAttachment extends StatelessWidget {
],
),
),
),
SizedBox(
height: 4.0,
),
+1
View File
@@ -619,6 +619,7 @@ class _MessageWidgetState extends State<MessageWidget> {
child: Material(
clipBehavior: Clip.hardEdge,
shape: attachmentShape,
type: MaterialType.transparency,
child: Transform(
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
alignment: Alignment.center,