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

@@ -12,4 +12,4 @@ class App extends StatelessWidget {
onGenerateRoute: RouteGenerator.generateRoute,
);
}
}
}

View File

@@ -173,7 +173,7 @@ class EasyAccess extends StatelessWidget {
onTap: () => {
print("Tapped $label"),
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:stream_chat_flutter/stream_chat_flutter.dart';
class Chat extends StatelessWidget{
String sport;
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 {
final List sport;
Chat(this.sport);
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text('$sport Chat'),
backgroundColor: Colors.green,
_Chat c = _Chat();
var x = c.init();
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text('${sport[0]} Chat'),
backgroundColor: Colors.green,
),
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,
),
),
body: Center(child: Text("Chat Goes Here")),
));
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(
title: IconButton(
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"
source: hosted
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:
dependency: transitive
description:
@@ -43,6 +50,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -71,6 +92,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description: flutter
@@ -83,6 +125,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct dev"
description: flutter
@@ -99,7 +169,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.12.1"
http_parser:
dependency: transitive
description:
@@ -114,6 +184,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -121,6 +198,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -135,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.6+3"
nested:
dependency: transitive
description:
@@ -142,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -149,13 +275,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
version: "1.9.0"
petitparser:
dependency: transitive
description:
@@ -163,13 +310,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.4"
version: "4.0.5+1"
quiver:
dependency: transitive
description:
@@ -190,14 +351,14 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.6+3"
version: "0.5.7"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+6"
version: "0.0.1+7"
shared_preferences_platform_interface:
dependency: transitive
description:
@@ -231,6 +392,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -245,6 +420,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -252,6 +441,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
table_calendar:
dependency: "direct main"
description:
@@ -287,6 +483,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -294,6 +525,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -302,5 +575,5 @@ packages:
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.13+hotfix.4 <2.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"

View File

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