Merge pull request #28 from GetStream/feature/productionConfig
move app config to separate file and use a production version on mast…
This commit is contained in:
@@ -30,6 +30,8 @@ jobs:
|
|||||||
- name: Flutter setup
|
- name: Flutter setup
|
||||||
run: |
|
run: |
|
||||||
flutter pub get
|
flutter pub get
|
||||||
|
- name: Copy production config
|
||||||
|
run: echo ${{ secrets.PRODUCTION_CONFIG }} > lib/app_config.dart
|
||||||
- name: Build and release
|
- name: Build and release
|
||||||
env:
|
env:
|
||||||
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
||||||
@@ -54,6 +56,8 @@ jobs:
|
|||||||
channel: 'stable'
|
channel: 'stable'
|
||||||
- run: |
|
- run: |
|
||||||
flutter pub get
|
flutter pub get
|
||||||
|
- name: Copy production config
|
||||||
|
run: echo ${{ secrets.PRODUCTION_CONFIG }} > lib/app_config.dart
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
flutter build apk
|
flutter build apk
|
||||||
|
|||||||
@@ -44,3 +44,4 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
lib/production_app_config.dart
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
|
const kDefaultStreamApiKey = 'kv7mcsxr24p8';
|
||||||
|
|
||||||
|
final defaultUsers = <String, User>{
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FsdmF0b3JlIn0.pgiJz7sIc7iP29BHKFwe3nLm5-OaR_1l2P-SlgiC9a8':
|
||||||
|
User(
|
||||||
|
id: 'salvatore',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Salvatore Giordano',
|
||||||
|
'image':
|
||||||
|
'https://avatars.githubusercontent.com/u/20601437?s=460&u=3f66c22a7483980624804054ae7f357cf102c784&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FoaWwifQ.WnIUoB5gR2kcAsFhiDvkiD6zdHXZ-VSU2aQWWkhsvfo':
|
||||||
|
User(
|
||||||
|
id: 'sahil',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Sahil Kumar',
|
||||||
|
'image':
|
||||||
|
'https://avatars.githubusercontent.com/u/25670178?s=400&u=30ded3784d8d2310c5748f263fd5e6433c119aa1&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiYmVuIn0.nAz2sNFGQwY7rl2Og2z3TGHUsdpnN53tOsUglJFvLmg':
|
||||||
|
User(
|
||||||
|
id: 'ben',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Ben Golden',
|
||||||
|
'image': 'https://avatars.githubusercontent.com/u/1581974?s=400&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGhpZXJyeSJ9.lEq6TrZtHzjoNtf7HHRufUPyGo_pa8vg4_XhEBp4ckY':
|
||||||
|
User(
|
||||||
|
id: 'thierry',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Thierry Schellenbach',
|
||||||
|
'image':
|
||||||
|
'https://avatars.githubusercontent.com/u/265409?s=400&u=2d0e3bb1820db992066196bff7b004f0eee8e28d&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.GLSI0ESshERMo2WjUpysD709NEtn1zmGimUN2an7g9o':
|
||||||
|
User(
|
||||||
|
id: 'tommaso',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Tommaso Barbugli',
|
||||||
|
'image': 'https://avatars.githubusercontent.com/u/88735?s=400&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZGV2ZW4ifQ.z3zI4PqJnNhc-1o-VKcmb6BnnQ0oxFNCRHwEulHqcWc':
|
||||||
|
User(
|
||||||
|
id: 'deven',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Deven Joshi',
|
||||||
|
'image':
|
||||||
|
'https://avatars.githubusercontent.com/u/26357843?s=400&u=0c61d890866e67bf69f58878be58915e9bfd39ee&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVldmFzaCJ9.3EdHegTxibrz3A9cTiKmpEyawwcCVB8FXnoFzr4eKvw':
|
||||||
|
User(
|
||||||
|
id: 'neevash',
|
||||||
|
extraData: {
|
||||||
|
'name': 'Neevash Ramdial',
|
||||||
|
'image':
|
||||||
|
'https://avatars.githubusercontent.com/u/25674767?s=400&u=1d7333baf7dd9d143db8bfcdb31a838b89cfff9c&v=4',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MSJ9.fnelU7HcP7QoEEsCGteNlF1fppofzNlrnpDQuIgeKCU':
|
||||||
|
User(
|
||||||
|
id: 'qatest1',
|
||||||
|
extraData: {
|
||||||
|
'name': 'QA test 1',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MiJ9.vSCqAEbs2WVmMWsOsa7065Fsjq-rsTih6qsHPynl7XM':
|
||||||
|
User(
|
||||||
|
id: 'qatest2',
|
||||||
|
extraData: {
|
||||||
|
'name': 'QA test 2',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
};
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|
||||||
|
|
||||||
class ChannelFileDisplayScreen extends StatefulWidget {
|
|
||||||
/// The sorting used for the channels matching the filters.
|
|
||||||
/// Sorting is based on field and direction, multiple sorting options can be provided.
|
|
||||||
/// You can sort based on last_updated, last_message_at, updated_at, created_at or member_count.
|
|
||||||
/// Direction can be ascending or descending.
|
|
||||||
final List<SortOption> sortOptions;
|
|
||||||
|
|
||||||
/// Pagination parameters
|
|
||||||
/// limit: the number of users to return (max is 30)
|
|
||||||
/// offset: the offset (max is 1000)
|
|
||||||
/// message_limit: how many messages should be included to each channel
|
|
||||||
final PaginationParams paginationParams;
|
|
||||||
|
|
||||||
/// The builder used when the file list is empty.
|
|
||||||
final WidgetBuilder emptyBuilder;
|
|
||||||
|
|
||||||
const ChannelFileDisplayScreen({
|
|
||||||
this.sortOptions,
|
|
||||||
this.paginationParams,
|
|
||||||
this.emptyBuilder,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ChannelFileDisplayScreenState createState() =>
|
|
||||||
_ChannelFileDisplayScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
|
||||||
messageSearchBloc.search(
|
|
||||||
filter: {
|
|
||||||
'cid': {
|
|
||||||
r'$in': [StreamChannel.of(context).channel.cid]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
messageFilter: {
|
|
||||||
'attachments.type': {
|
|
||||||
r'$in': ['file'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sort: widget.sortOptions,
|
|
||||||
pagination: widget.paginationParams,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
|
||||||
appBar: AppBar(
|
|
||||||
brightness: Theme.of(context).brightness,
|
|
||||||
elevation: 1,
|
|
||||||
centerTitle: true,
|
|
||||||
title: Text(
|
|
||||||
'Files',
|
|
||||||
style: TextStyle(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
fontSize: 16.0),
|
|
||||||
),
|
|
||||||
leading: Center(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 24.0,
|
|
||||||
height: 24.0,
|
|
||||||
child: StreamSvgIcon.left(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
|
||||||
),
|
|
||||||
body: _buildMediaGrid(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMediaGrid() {
|
|
||||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
|
||||||
|
|
||||||
return StreamBuilder<List<GetMessageResponse>>(
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return Center(
|
|
||||||
child: const CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snapshot.data.isEmpty) {
|
|
||||||
if (widget.emptyBuilder != null) {
|
|
||||||
return widget.emptyBuilder(context);
|
|
||||||
}
|
|
||||||
return Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.files(
|
|
||||||
size: 136.0,
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.greyGainsboro,
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.0),
|
|
||||||
Text(
|
|
||||||
'No Files',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'Files sent in this chat will appear here',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.black
|
|
||||||
.withOpacity(0.5),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final media = <Attachment, Message>{};
|
|
||||||
|
|
||||||
for (var item in snapshot.data) {
|
|
||||||
item.message.attachments.where((e) => e.type == 'file').forEach((e) {
|
|
||||||
media[e] = item.message;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return LazyLoadScrollView(
|
|
||||||
onEndOfPage: () => messageSearchBloc.loadMore(
|
|
||||||
filter: {
|
|
||||||
'cid': {
|
|
||||||
r'$in': [StreamChannel.of(context).channel.cid]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
messageFilter: {
|
|
||||||
'attachments.type': {
|
|
||||||
r'$in': ['file']
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sort: widget.sortOptions,
|
|
||||||
pagination: widget.paginationParams.copyWith(
|
|
||||||
offset: messageSearchBloc.messageResponses?.length ?? 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: ListView.builder(
|
|
||||||
itemBuilder: (context, position) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(1.0),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: FileAttachment(
|
|
||||||
message: media.values.toList()[position],
|
|
||||||
attachment: media.keys.toList()[position],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
itemCount: media.length,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
stream: messageSearchBloc.messagesStream,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|
||||||
import 'package:video_player/video_player.dart';
|
|
||||||
|
|
||||||
class ChannelMediaDisplayScreen extends StatefulWidget {
|
|
||||||
/// The sorting used for the channels matching the filters.
|
|
||||||
/// Sorting is based on field and direction, multiple sorting options can be provided.
|
|
||||||
/// You can sort based on last_updated, last_message_at, updated_at, created_at or member_count.
|
|
||||||
/// Direction can be ascending or descending.
|
|
||||||
final List<SortOption> sortOptions;
|
|
||||||
|
|
||||||
/// Pagination parameters
|
|
||||||
/// limit: the number of users to return (max is 30)
|
|
||||||
/// offset: the offset (max is 1000)
|
|
||||||
/// message_limit: how many messages should be included to each channel
|
|
||||||
final PaginationParams paginationParams;
|
|
||||||
|
|
||||||
/// The builder used when the file list is empty.
|
|
||||||
final WidgetBuilder emptyBuilder;
|
|
||||||
|
|
||||||
final ShowMessageCallback onShowMessage;
|
|
||||||
|
|
||||||
const ChannelMediaDisplayScreen({
|
|
||||||
this.sortOptions,
|
|
||||||
this.paginationParams,
|
|
||||||
this.emptyBuilder,
|
|
||||||
this.onShowMessage,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ChannelMediaDisplayScreenState createState() =>
|
|
||||||
_ChannelMediaDisplayScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
|
|
||||||
Map<String, VideoPlayerController> controllerCache = {};
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
|
||||||
messageSearchBloc.search(
|
|
||||||
filter: {
|
|
||||||
'cid': {
|
|
||||||
r'$in': [StreamChannel.of(context).channel.cid],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
messageFilter: {
|
|
||||||
'attachments.type': {
|
|
||||||
r'$in': ['image', 'video']
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sort: widget.sortOptions,
|
|
||||||
pagination: widget.paginationParams,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
|
||||||
appBar: AppBar(
|
|
||||||
brightness: Theme.of(context).brightness,
|
|
||||||
elevation: 1,
|
|
||||||
centerTitle: true,
|
|
||||||
title: Text(
|
|
||||||
'Photos & Videos',
|
|
||||||
style: TextStyle(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
fontSize: 16.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
leading: Center(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 24.0,
|
|
||||||
height: 24.0,
|
|
||||||
child: StreamSvgIcon.left(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
|
||||||
),
|
|
||||||
body: _buildMediaGrid(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMediaGrid() {
|
|
||||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
|
||||||
|
|
||||||
return StreamBuilder<List<GetMessageResponse>>(
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return Center(
|
|
||||||
child: const CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snapshot.data.isEmpty) {
|
|
||||||
if (widget.emptyBuilder != null) {
|
|
||||||
return widget.emptyBuilder(context);
|
|
||||||
}
|
|
||||||
return Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.pictures(
|
|
||||||
size: 136.0,
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.greyGainsboro,
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.0),
|
|
||||||
Text(
|
|
||||||
'No Media',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'Photos or video sent in this chat will \nappear here',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.black
|
|
||||||
.withOpacity(0.5),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final media = <_AssetPackage>[];
|
|
||||||
|
|
||||||
for (var item in snapshot.data) {
|
|
||||||
item.message.attachments
|
|
||||||
.where((e) =>
|
|
||||||
(e.type == 'image' || e.type == 'video') &&
|
|
||||||
e.ogScrapeUrl == null)
|
|
||||||
.forEach((e) {
|
|
||||||
VideoPlayerController controller;
|
|
||||||
if (e.type == 'video') {
|
|
||||||
var cachedController = controllerCache[e.assetUrl];
|
|
||||||
|
|
||||||
if (cachedController == null) {
|
|
||||||
controller = VideoPlayerController.network(e.assetUrl);
|
|
||||||
controller.initialize();
|
|
||||||
controllerCache[e.assetUrl] = controller;
|
|
||||||
} else {
|
|
||||||
controller = cachedController;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
media.add(_AssetPackage(e, item.message, controller));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return LazyLoadScrollView(
|
|
||||||
onEndOfPage: () => messageSearchBloc.loadMore(
|
|
||||||
filter: {
|
|
||||||
'cid': {
|
|
||||||
r'$in': [StreamChannel.of(context).channel.cid]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
messageFilter: {
|
|
||||||
'attachments.type': {
|
|
||||||
r'$in': ['image', 'video']
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sort: widget.sortOptions,
|
|
||||||
pagination: widget.paginationParams.copyWith(
|
|
||||||
offset: messageSearchBloc.messageResponses?.length ?? 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: GridView.builder(
|
|
||||||
gridDelegate:
|
|
||||||
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
|
||||||
itemBuilder: (context, position) {
|
|
||||||
var channel = StreamChannel.of(context).channel;
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(1.0),
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: FullScreenMedia(
|
|
||||||
mediaAttachments:
|
|
||||||
media.map((e) => e.attachment).toList(),
|
|
||||||
startIndex: position,
|
|
||||||
message: media[position].message,
|
|
||||||
sentAt: media[position].message.createdAt,
|
|
||||||
userName: media[position].message.user.name,
|
|
||||||
onShowMessage: widget.onShowMessage,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: media[position].attachment.type == 'image'
|
|
||||||
? IgnorePointer(
|
|
||||||
child: ImageAttachment(
|
|
||||||
attachment: media[position].attachment,
|
|
||||||
message: media[position].message,
|
|
||||||
showTitle: false,
|
|
||||||
size: Size(
|
|
||||||
MediaQuery.of(context).size.width * 0.8,
|
|
||||||
MediaQuery.of(context).size.height * 0.3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: VideoPlayer(media[position].videoPlayer),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
itemCount: media.length,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
stream: messageSearchBloc.messagesStream,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
for (var c in controllerCache.values) {
|
|
||||||
c.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AssetPackage {
|
|
||||||
Attachment attachment;
|
|
||||||
Message message;
|
|
||||||
VideoPlayerController videoPlayer;
|
|
||||||
|
|
||||||
_AssetPackage(this.attachment, this.message, this.videoPlayer);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'package:example/channel_file_display_screen.dart';
|
|
||||||
import 'package:example/channel_media_display_screen.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:example/app_config.dart';
|
||||||
import 'package:example/stream_version.dart';
|
import 'package:example/stream_version.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -10,88 +11,11 @@ import 'routes/routes.dart';
|
|||||||
const kStreamApiKey = 'STREAM_API_KEY';
|
const kStreamApiKey = 'STREAM_API_KEY';
|
||||||
const kStreamUserId = 'STREAM_USER_ID';
|
const kStreamUserId = 'STREAM_USER_ID';
|
||||||
const kStreamToken = 'STREAM_TOKEN';
|
const kStreamToken = 'STREAM_TOKEN';
|
||||||
const kDefaultStreamApiKey = 'kv7mcsxr24p8';
|
|
||||||
|
|
||||||
class ChooseUserPage extends StatelessWidget {
|
class ChooseUserPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final users = <String, User>{
|
final users = defaultUsers;
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FsdmF0b3JlIn0.pgiJz7sIc7iP29BHKFwe3nLm5-OaR_1l2P-SlgiC9a8':
|
|
||||||
User(
|
|
||||||
id: 'salvatore',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Salvatore Giordano',
|
|
||||||
'image':
|
|
||||||
'https://avatars.githubusercontent.com/u/20601437?s=460&u=3f66c22a7483980624804054ae7f357cf102c784&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FoaWwifQ.WnIUoB5gR2kcAsFhiDvkiD6zdHXZ-VSU2aQWWkhsvfo':
|
|
||||||
User(
|
|
||||||
id: 'sahil',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Sahil Kumar',
|
|
||||||
'image':
|
|
||||||
'https://avatars.githubusercontent.com/u/25670178?s=400&u=30ded3784d8d2310c5748f263fd5e6433c119aa1&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiYmVuIn0.nAz2sNFGQwY7rl2Og2z3TGHUsdpnN53tOsUglJFvLmg':
|
|
||||||
User(
|
|
||||||
id: 'ben',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Ben Golden',
|
|
||||||
'image': 'https://avatars.githubusercontent.com/u/1581974?s=400&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGhpZXJyeSJ9.lEq6TrZtHzjoNtf7HHRufUPyGo_pa8vg4_XhEBp4ckY':
|
|
||||||
User(
|
|
||||||
id: 'thierry',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Thierry Schellenbach',
|
|
||||||
'image':
|
|
||||||
'https://avatars.githubusercontent.com/u/265409?s=400&u=2d0e3bb1820db992066196bff7b004f0eee8e28d&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.GLSI0ESshERMo2WjUpysD709NEtn1zmGimUN2an7g9o':
|
|
||||||
User(
|
|
||||||
id: 'tommaso',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Tommaso Barbugli',
|
|
||||||
'image': 'https://avatars.githubusercontent.com/u/88735?s=400&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZGV2ZW4ifQ.z3zI4PqJnNhc-1o-VKcmb6BnnQ0oxFNCRHwEulHqcWc':
|
|
||||||
User(
|
|
||||||
id: 'deven',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Deven Joshi',
|
|
||||||
'image':
|
|
||||||
'https://avatars.githubusercontent.com/u/26357843?s=400&u=0c61d890866e67bf69f58878be58915e9bfd39ee&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVldmFzaCJ9.3EdHegTxibrz3A9cTiKmpEyawwcCVB8FXnoFzr4eKvw':
|
|
||||||
User(
|
|
||||||
id: 'neevash',
|
|
||||||
extraData: {
|
|
||||||
'name': 'Neevash Ramdial',
|
|
||||||
'image':
|
|
||||||
'https://avatars.githubusercontent.com/u/25674767?s=400&u=1d7333baf7dd9d143db8bfcdb31a838b89cfff9c&v=4',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MSJ9.fnelU7HcP7QoEEsCGteNlF1fppofzNlrnpDQuIgeKCU':
|
|
||||||
User(
|
|
||||||
id: 'qatest1',
|
|
||||||
extraData: {
|
|
||||||
'name': 'QA test 1',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MiJ9.vSCqAEbs2WVmMWsOsa7065Fsjq-rsTih6qsHPynl7XM':
|
|
||||||
User(
|
|
||||||
id: 'qatest2',
|
|
||||||
extraData: {
|
|
||||||
'name': 'QA test 2',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
|
backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/channel_file_display_screen.dart';
|
|
||||||
import 'package:example/channel_media_display_screen.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|||||||
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
||||||
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
||||||
|
|
||||||
|
import 'app_config.dart';
|
||||||
import 'notifications_service.dart';
|
import 'notifications_service.dart';
|
||||||
import 'routes/app_routes.dart';
|
import 'routes/app_routes.dart';
|
||||||
import 'routes/routes.dart';
|
import 'routes/routes.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user