diff --git a/lib/header/app_header.dart b/lib/header/app_header.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/home/home_screen.dart b/lib/home/home_screen.dart new file mode 100644 index 0000000..3cc43af --- /dev/null +++ b/lib/home/home_screen.dart @@ -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 createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + @override + Widget build(BuildContext context) { + SignalRHelper signalRHelper= SignalRHelper(); + return AppScaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + signalRHelper.msg, + ), + ], + ), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/lib/home/que_item.dart b/lib/home/que_item.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/home/que_item_list.dart b/lib/home/que_item_list.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/main.dart b/lib/main.dart index d819906..ffcdf1f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:queuing_system/utils/signalR_utils.dart'; import 'core/base/app_scaffold_widget.dart'; import 'core/base/project_view_model.dart'; import 'core/config/size_config.dart'; +import 'home/home_screen.dart'; void main() { runApp(const MyApp()); @@ -47,58 +49,3 @@ class MyApp extends StatelessWidget { } } -class MyHomePage extends StatefulWidget { - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - String title ="MyHomePage"; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: Center( - - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], - ), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); - } -} diff --git a/lib/utils/signalR_utils.dart b/lib/utils/signalR_utils.dart new file mode 100644 index 0000000..7c10276 --- /dev/null +++ b/lib/utils/signalR_utils.dart @@ -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(); + } + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 750a090..b88033d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -71,6 +71,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + equatable: + dependency: transitive + description: + name: equatable + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" fake_async: dependency: transitive description: @@ -149,6 +163,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" matcher: dependency: transitive description: @@ -212,6 +233,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.2" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1+1" + signalr_core: + dependency: "direct main" + description: + name: signalr_core + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" sky_engine: dependency: transitive description: flutter @@ -224,6 +259,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" + sse_client: + dependency: transitive + description: + name: sse_client + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" stack_trace: dependency: transitive description: @@ -259,6 +301,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.3" + tuple: + dependency: transitive + description: + name: tuple + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" typed_data: dependency: transitive description: @@ -273,6 +322,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" xml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 11c8771..f2656a8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,6 +39,10 @@ dependencies: flutter_svg: ^1.0.3 http: ^0.13.0 + #signalr core + signalr_core: ^1.1.1 + +