Merge branch 'singleR' into 'master'
Single r See merge request Cloud_Solution/queuing_system!1dev_faiz
commit
79df7137c2
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:queuing_system/core/base/app_scaffold_widget.dart';
|
||||||
|
import 'package:queuing_system/utils/signalR_utils.dart';
|
||||||
|
|
||||||
|
class MyHomePage extends StatefulWidget {
|
||||||
|
|
||||||
|
|
||||||
|
String title ="MyHomePage";
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyHomePage> createState() => _MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SignalRHelper signalRHelper= SignalRHelper();
|
||||||
|
return AppScaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(widget.title),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
signalRHelper.msg,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:signalr_core/signalr_core.dart';
|
||||||
|
|
||||||
|
class SignalRHelper{
|
||||||
|
|
||||||
|
String hubBaseURL ="";
|
||||||
|
String msg ="Elham";
|
||||||
|
HubConnection connection;
|
||||||
|
SignalRHelper(){
|
||||||
|
connection = HubConnectionBuilder()
|
||||||
|
.withUrl(
|
||||||
|
hubBaseURL,
|
||||||
|
HttpConnectionOptions(
|
||||||
|
logging: (level, message) {
|
||||||
|
msg = message;
|
||||||
|
print("$message");
|
||||||
|
},
|
||||||
|
)
|
||||||
|
).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
closeConnection(BuildContext context) async {
|
||||||
|
if(connection.state == HubConnectionState.connected)
|
||||||
|
{
|
||||||
|
await connection.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue