minor fixes
This commit is contained in:
@@ -1 +1 @@
|
|||||||
bb5f9103d9045cd6244bcae1f5f343e5
|
c3e639ccf9b069e37a7d1345194e6b99
|
||||||
@@ -94,6 +94,8 @@ class ChooseUserPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 32),
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
separatorBuilder: (context, i) {
|
separatorBuilder: (context, i) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -217,6 +219,7 @@ class ChooseUserPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
StreamVersion(),
|
StreamVersion(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
+46
-29
@@ -21,7 +21,7 @@ void main() async {
|
|||||||
logLevel: Level.INFO,
|
logLevel: Level.INFO,
|
||||||
showLocalNotification:
|
showLocalNotification:
|
||||||
(!kIsWeb && Platform.isAndroid) ? showLocalNotification : null,
|
(!kIsWeb && Platform.isAndroid) ? showLocalNotification : null,
|
||||||
persistenceEnabled: false,
|
persistenceEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
@@ -43,6 +43,7 @@ class MyApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData.light(),
|
theme: ThemeData.light(),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
//TODO change to system once dark theme is implemented
|
//TODO change to system once dark theme is implemented
|
||||||
@@ -63,7 +64,45 @@ class ChannelListPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = StreamChat.of(context).user;
|
final user = StreamChat.of(context).user;
|
||||||
return Scaffold(
|
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: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
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,
|
limit: 25,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
),
|
),
|
||||||
|
filter: {
|
||||||
|
'id': {
|
||||||
|
r'$ne': client.state.user.id,
|
||||||
|
}
|
||||||
|
},
|
||||||
sort: [
|
sort: [
|
||||||
SortOption(
|
SortOption(
|
||||||
'name',
|
'name',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.0.60+62
|
version: 1.0.62+64
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class ChannelListView extends StatefulWidget {
|
|||||||
this.errorBuilder,
|
this.errorBuilder,
|
||||||
this.emptyBuilder,
|
this.emptyBuilder,
|
||||||
this.onImageTap,
|
this.onImageTap,
|
||||||
|
this.onStartChatPressed,
|
||||||
this.swipeToAction = false,
|
this.swipeToAction = false,
|
||||||
this.pullToRefresh = true,
|
this.pullToRefresh = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@@ -129,6 +130,9 @@ class ChannelListView extends StatefulWidget {
|
|||||||
/// Set it to false to disable the pull-to-refresh widget
|
/// Set it to false to disable the pull-to-refresh widget
|
||||||
final bool pullToRefresh;
|
final bool pullToRefresh;
|
||||||
|
|
||||||
|
/// Callback used in the default empty list widget
|
||||||
|
final VoidCallback onStartChatPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ChannelListViewState createState() => _ChannelListViewState();
|
_ChannelListViewState createState() => _ChannelListViewState();
|
||||||
}
|
}
|
||||||
@@ -185,14 +189,70 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
builder: (context, viewportConstraints) {
|
builder: (context, viewportConstraints) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
physics: AlwaysScrollableScrollPhysics(),
|
physics: AlwaysScrollableScrollPhysics(),
|
||||||
child: ConstrainedBox(
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minHeight: viewportConstraints.maxHeight,
|
minHeight: viewportConstraints.maxHeight,
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Column(
|
||||||
child: Text('You have no channels currently'),
|
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(
|
||||||
|
'Let’s 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
|
return Container(
|
||||||
? _buildLoadingItem()
|
height: 100,
|
||||||
: Container(
|
padding: EdgeInsets.all(32),
|
||||||
height: 70,
|
child: Center(
|
||||||
|
child: snapshot.data ? CircularProgressIndicator() : Container(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
DecoratedBox(
|
Card(
|
||||||
decoration: BoxDecoration(),
|
|
||||||
child: Card(
|
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@@ -64,8 +62,7 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context,
|
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
||||||
MaterialPageRoute(builder: (_) {
|
|
||||||
return FullScreenImage(
|
return FullScreenImage(
|
||||||
url: attachment.imageUrl ??
|
url: attachment.imageUrl ??
|
||||||
attachment.assetUrl ??
|
attachment.assetUrl ??
|
||||||
@@ -122,8 +119,7 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'GIPHY',
|
'GIPHY',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: StreamChatTheme.of(context).accentColor,
|
||||||
StreamChatTheme.of(context).accentColor,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 11.0,
|
fontSize: 11.0,
|
||||||
),
|
),
|
||||||
@@ -247,7 +243,6 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 4.0,
|
height: 4.0,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -619,6 +619,7 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
shape: attachmentShape,
|
shape: attachmentShape,
|
||||||
|
type: MaterialType.transparency,
|
||||||
child: Transform(
|
child: Transform(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
|||||||
Reference in New Issue
Block a user