CHATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

This commit is contained in:
Carlos Lopez-Rosario
2020-05-03 03:25:59 -04:00
parent 203bb03464
commit 68460c8b20
6 changed files with 376 additions and 21 deletions

View File

@@ -173,7 +173,7 @@ class EasyAccess extends StatelessWidget {
onTap: () => { onTap: () => {
print("Tapped $label"), print("Tapped $label"),
if(label == 'Chat'){ if(label == 'Chat'){
Navigator.pushNamed(context, '/Chat', arguments: gameCard.sportTitle) Navigator.pushNamed(context, '/Chat', arguments: [gameCard.sportTitle, gameCard.idSport])
} }
}, },
); );

View File

@@ -1,19 +1,101 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
class _Chat {
final client = Client(
'xqf4gbfwu2ec',
logLevel: Level.INFO,
);
Future<Client> init() async {
await client.setGuestUser(
User(id: 'You'
),
);
final user = User(id: "carlos", extraData: {
"name": "John Doe",
});
await client.setUser(
user,
client.devToken("carlos"),
);
return client;
}
}
class Chat extends StatelessWidget { class Chat extends StatelessWidget {
String sport; final List sport;
Chat(this.sport); Chat(this.sport);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder( _Chat c = _Chat();
builder: (context, StateSetter setState) => Scaffold( var x = c.init();
return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: false, centerTitle: false,
title: Text('$sport Chat'), title: Text('${sport[0]} Chat'),
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
body: Center(child: Text("Chat Goes Here")), body: FutureBuilder(
)); future: x,
builder: (context, snapshot){
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
} else {
return ContainerWithInterceptor(snapshot.data, sport[1]);
}
},
),
);
}
}
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Expanded(
child: MessageListView(
// messageBuilder: _messageBuilder,
),
),
MessageInput(),
],
);
}
}
class ContainerWithInterceptor extends StatefulWidget {
final Client client;
final int sport;
ContainerWithInterceptor(this.client, this.sport);
@override
State createState() => _ContainerWithInterceptorState();
}
class _ContainerWithInterceptorState extends State<ContainerWithInterceptor> {
Widget build(BuildContext context) {
var cc = widget.client.channel("messaging", id: "${widget.sport}");
print(widget.sport);
print("-------------------------------------------------------------");
cc.watch();
return StreamChat(
client: widget.client,
child: StreamChannel(
channel: cc,
child: ChannelPage(),
),
);
} }
} }

View File

@@ -105,7 +105,7 @@ class Sport extends StatelessWidget {
ListTile( ListTile(
title: IconButton( title: IconButton(
icon: Icon(Icons.message), icon: Icon(Icons.message),
onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: _curSport.name), onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: [sport_ID, _curSport.name]),
), ),
) )
], ],

View File

@@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
@@ -43,6 +50,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.3" version: "1.1.3"
chewie:
dependency: transitive
description:
name: chewie
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.10"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@@ -71,6 +92,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
dio:
dependency: transitive
description:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.9"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
file_picker:
dependency: transitive
description:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -83,6 +125,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
flutter_keyboard_visibility:
dependency: transitive
description:
name: flutter_keyboard_visibility
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.0"
flutter_markdown:
dependency: transitive
description:
name: flutter_markdown
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -99,7 +169,7 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.0+4" version: "0.12.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@@ -114,6 +184,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.12" version: "2.1.12"
image_picker:
dependency: transitive
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5+3"
intl: intl:
dependency: transitive dependency: transitive
description: description:
@@ -121,6 +198,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.1"
jiffy:
dependency: transitive
description:
name: jiffy
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
markdown:
dependency: transitive
description:
name: markdown
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@@ -135,6 +247,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.8" version: "1.1.8"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.6+3"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@@ -142,6 +261,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.4" version: "0.0.4"
open_iconic_flutter:
dependency: transitive
description:
name: open_iconic_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@@ -149,13 +275,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.7"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0+1" version: "1.9.0"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@@ -163,13 +310,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
provider: provider:
dependency: transitive dependency: transitive
description: description:
name: provider name: provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.4" version: "4.0.5+1"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
@@ -190,14 +351,14 @@ packages:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.6+3" version: "0.5.7"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_macos name: shared_preferences_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+6" version: "0.0.1+7"
shared_preferences_platform_interface: shared_preferences_platform_interface:
dependency: transitive dependency: transitive
description: description:
@@ -231,6 +392,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.7.0"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@@ -245,6 +420,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
stream_chat:
dependency: transitive
description:
name: stream_chat
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.26"
stream_chat_flutter:
dependency: "direct main"
description:
name: stream_chat_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.26"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@@ -252,6 +441,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
table_calendar: table_calendar:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -287,6 +483,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
url_launcher:
dependency: transitive
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.5"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+5"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+2"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@@ -294,6 +525,48 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
video_player:
dependency: transitive
description:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.9+1"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+1"
visibility_detector:
dependency: transitive
description:
name: visibility_detector
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
wakelock:
dependency: transitive
description:
name: wakelock
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4+1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
xml: xml:
dependency: transitive dependency: transitive
description: description:
@@ -302,5 +575,5 @@ packages:
source: hosted source: hosted
version: "3.6.1" version: "3.6.1"
sdks: sdks:
dart: ">=2.6.0 <3.0.0" dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.4 <2.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0"

View File

@@ -21,7 +21,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_bloc: ^3.2.0 flutter_bloc: ^3.2.0
stream_chat_flutter: ^0.1.2
http: ^0.12.0+4 http: ^0.12.0+4
shared_preferences: ^0.5.6+3 shared_preferences: ^0.5.6+3