Update loading + add image configuration if exist + upgrade packages

This commit is contained in:
Thomas Fransolet 2023-11-02 13:24:24 +01:00
parent 0c80aadd9e
commit 87f1443f0c
12 changed files with 82 additions and 55 deletions

View File

@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:manager_api/api.dart';
import 'package:mqtt_client/mqtt_browser_client.dart';
//import 'package:mqtt_client/mqtt_browser_client.dart';
import 'package:mqtt_client/mqtt_client.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:tablet_app/Helpers/DeviceInfoHelper.dart';
@ -22,9 +22,9 @@ class MQTTHelper {
TabletAppContext tabletAppContext = appContext.getContext();
if(kIsWeb) {
tabletAppContext.clientBrowserMQTT!.updates!.listen((List<MqttReceivedMessage<MqttMessage>> c) async {
/*tabletAppContext.clientBrowserMQTT!.updates!.listen((List<MqttReceivedMessage<MqttMessage>> c) async {
handleMessage(appContext, c);
});
});*/
} else {
tabletAppContext.clientMQTT!.updates!.listen((List<MqttReceivedMessage<MqttMessage>> c) async {
handleMessage(appContext, c);
@ -141,7 +141,7 @@ class MQTTHelper {
.withWillQos(MqttQos.atLeastOnce);
if(kIsWeb) {
tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883);
/*tabletAppContext.clientBrowserMQTT = MqttBrowserClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883);
tabletAppContext.clientBrowserMQTT!.logging(on: false);
tabletAppContext.clientBrowserMQTT!.keepAlivePeriod = 20;
tabletAppContext.clientBrowserMQTT!.onDisconnected = onDisconnected;
@ -176,7 +176,7 @@ class MQTTHelper {
} catch (e) {
print('Exception clientBrowserMQTT: $e');
tabletAppContext.clientBrowserMQTT!.disconnect();
}
}*/
} else {
tabletAppContext.clientMQTT = MqttServerClient.withPort(hostToTake!.replaceAll('http://', ''), 'tablet_app_'+identifier!, 1883);
tabletAppContext.clientMQTT!.logging(on: false);
@ -218,7 +218,8 @@ class MQTTHelper {
isInstantiated = true;
return kIsWeb ? tabletAppContext.clientBrowserMQTT : tabletAppContext.clientMQTT!;
//return kIsWeb ? tabletAppContext.clientBrowserMQTT : tabletAppContext.clientMQTT!;
return tabletAppContext.clientMQTT!;
}
Future<void> updateDevice(dynamic appContext) async {

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:manager_api/api.dart';
import 'package:mqtt_client/mqtt_browser_client.dart';
//import 'package:mqtt_client/mqtt_browser_client.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:tablet_app/client.dart';
import 'dart:convert';
@ -9,7 +9,7 @@ import 'dart:convert';
class TabletAppContext with ChangeNotifier{
Client? clientAPI;
MqttServerClient? clientMQTT;
MqttBrowserClient? clientBrowserMQTT;
//MqttBrowserClient? clientBrowserMQTT;
String? id;
String? host;
ConfigurationDTO? configuration;

View File

@ -5,7 +5,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:manager_api/api.dart';
import 'package:mqtt_client/mqtt_browser_client.dart';
//import 'package:mqtt_client/mqtt_browser_client.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:provider/provider.dart';
import 'package:tablet_app/Components/Buttons/rounded_button.dart';
@ -39,7 +39,7 @@ class _ConfigViewWidget extends State<ConfigViewWidget> {
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
SystemChrome.setEnabledSystemUIOverlays([]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
Size size = MediaQuery.of(context).size;
TabletAppContext tabletAppContext = appContext.getContext();
@ -137,7 +137,7 @@ class _ConfigViewWidget extends State<ConfigViewWidget> {
return Center(
child: Container(
height: size.height * 0.2,
child: kIsWeb ? LoadingCommon() : Loading()
child: LoadingCommon()
)
);
}
@ -205,11 +205,11 @@ class _ConfigViewWidget extends State<ConfigViewWidget> {
var identifier = kIsWeb ? "WEB TEST" : await DeviceInfoHelper.getDeviceDetails();
if(kIsWeb) {
tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!);
//tabletAppContext.clientBrowserMQTT = new MqttBrowserClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!);
} else
{
// mobile specific
tabletAppContext!.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!);
tabletAppContext.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+ identifier!);
}
setState(() {

View File

@ -33,15 +33,18 @@ class MainViewWidget extends StatefulWidget {
class _MainViewWidget extends State<MainViewWidget> {
Size sizeScreen = new Size(1080.0, 1920.0); // Tablet resolution
SectionDTO? sectionSelected;
late ConfigurationDTO configurationDTO;
int rowCount = 4;
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
SystemChrome.setEnabledSystemUIOverlays([]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
Size size = MediaQuery.of(context).size;
configurationDTO = appContext.getContext().configuration;
if (!MQTTHelper.instance.isInstantiated)
MQTTHelper.instance.connect(appContext);
@ -87,7 +90,16 @@ class _MainViewWidget extends State<MainViewWidget> {
child: Container(
height: size.height,
width: size.width,
color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey,
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
decoration: configurationDTO.imageId != null ? BoxDecoration(
image: new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.7), BlendMode.color),
image: new NetworkImage(
configurationDTO.imageSource!,
),
),
) : null,
child: Column(
children: [
Container(
@ -177,12 +189,15 @@ class _MainViewWidget extends State<MainViewWidget> {
width: kIsWeb ? size.width *0.08: 185.0,
child: FittedBox(
child: FloatingActionButton.extended(
backgroundColor: kBackgroundColor,
focusColor: kBackgroundColor,
splashColor: kBackgroundColor,
onPressed: () {
setState(() {
sectionSelected = null;
});
},
icon: Icon(Icons.arrow_back),
icon: Icon(Icons.arrow_back, color: Colors.grey),
label: Text("Menu")
),
),
@ -194,10 +209,19 @@ class _MainViewWidget extends State<MainViewWidget> {
body: Container(
height: size.height,
width: size.width,
color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey,
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
decoration: configurationDTO.imageId != null ? BoxDecoration(
image: new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.7), BlendMode.color),
image: new NetworkImage(
configurationDTO.imageSource!,
),
),
) : null,
child: Stack(
children: [
if (appContext.getContext().configuration != null) LanguageSelection(),
if (configurationDTO != null) LanguageSelection(),
Center(
child: Container(
height: kIsWeb ? size.height : size.height * 0.85,
@ -264,7 +288,7 @@ class _MainViewWidget extends State<MainViewWidget> {
} else {
return Center(
child: Container(
child: kIsWeb ? LoadingCommon() : Loading()
child: LoadingCommon()
)
);
}

View File

@ -82,7 +82,7 @@ class _MapViewWidget extends State<MapViewWidget> {
} else {
return Center(
child: Container(
child: kIsWeb ? LoadingCommon() : Loading()
child: LoadingCommon()
)
);
}

View File

@ -142,7 +142,7 @@ class _PreviousViewWidget extends State<PreviousViewWidget> with TickerProviderS
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIOverlays([]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
Size size = MediaQuery
.of(context)
.size;

View File

@ -22,6 +22,8 @@ class _SliderViewWidget extends State<SliderViewWidget> {
CarouselController? sliderController;
int currentIndex = 1;
late ConfigurationDTO configurationDTO;
@override
void initState() {
sliderController = CarouselController();
@ -43,6 +45,8 @@ class _SliderViewWidget extends State<SliderViewWidget> {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
configurationDTO = appContext.getContext().configuration;
return Stack(
children: [
Column(
@ -70,7 +74,7 @@ class _SliderViewWidget extends State<SliderViewWidget> {
height: MediaQuery.of(context).size.height,
margin: EdgeInsets.symmetric(horizontal: 5.0),
decoration: BoxDecoration(
color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey,
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
borderRadius: BorderRadius.circular(10.0),
//border: Border.all(width: 0.3, color: kSecondGrey),
),

View File

@ -1,5 +1,5 @@
import 'dart:convert';
import 'dart:html';
//import 'dart:html';
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
@ -18,7 +18,7 @@ class WebView extends StatefulWidget {
}
class _WebViewWidget extends State<WebView> {
final IFrameElement _iframeElement = IFrameElement();
//final IFrameElement _iframeElement = IFrameElement();
//WebView _webView;
WebDTO webDTO = WebDTO();
WebViewController? controller;
@ -31,14 +31,14 @@ class _WebViewWidget extends State<WebView> {
print(webDTO);
if(kIsWeb) {
_iframeElement.src = webDTO.source_!;
/*_iframeElement.src = webDTO.source_!;
_iframeElement.style.border = 'none';
//ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(
webDTO.source_!, //use source as registered key to ensure uniqueness
(int viewId) => _iframeElement,
);
);*/
} else {
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
@ -94,7 +94,6 @@ class _WebViewWidget extends State<WebView> {
key: UniqueKey(),
viewType: webDTO.source_!,
) :
//WebViewWidget(controller: controller!)
Text("sousou"):
WebViewWidget(controller: controller!) :
Center(child: Text("La page internet ne peut pas être affichée, l'url est incorrecte ou vide"));
} //_webView

View File

@ -23,7 +23,7 @@ void main() async {
localContext = await DatabaseHelper.instance.getData();
}
if(localContext != null) {
if(localContext != null && localContext.host != null) {
print("we've got an local db !");
localContext.clientAPI = new Client(localContext.host!);
isConfig = localContext.configuration != null;

View File

@ -7,10 +7,10 @@ version: '1.0.0'
description: 'OpenAPI API client'
homepage: 'homepage'
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=3.1.0 <4.0.0"
dependencies:
http: '>=0.13.0 <0.14.0'
intl: '^0.17.0'
http: '^1.1.0'
intl: '^0.18.0'
meta: '^1.1.8'
dev_dependencies:
test: '>=1.16.0 <1.18.0'

View File

@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.0+4
version: 1.5.0+5
environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.1.0 <4.0.0"
dependencies:
flutter:
@ -26,43 +26,42 @@ dependencies:
# Specific Mobile
sqflite: # Specific mobile and macOS
webview_flutter: ^4.0.1 # Specific mobile # old : ^3.0.4
google_maps_flutter: ^2.0.1 # Specific mobile
youtube_player_flutter: ^8.1.1 # Specific mobile
webview_flutter: ^4.4.1 # Specific mobile # old : ^3.0.4
google_maps_flutter: ^2.5.0 # Specific mobile
youtube_player_flutter: ^8.1.2 # Specific mobile
# Specific Web
google_maps_flutter_web: ^0.4.0+5 # Specific WEB
youtube_player_iframe: ^4.0.1 # Handle mobile and web here => TO TEST
google_maps_flutter_web: ^0.5.4+2 # Specific WEB
youtube_player_iframe: ^4.0.4 # Handle mobile and web here => TO TEST
flare_flutter: ^3.0.1
provider: ^6.0.4
http: ^0.13.5
flare_flutter: ^3.0.2
provider: ^6.0.5
http: ^1.1.0
auto_size_text: ^3.0.0
fluttertoast:
device_info: ^2.0.2 # DISCONTINUED
enum_to_string: ^2.0.1
carousel_slider: ^4.0.0
mqtt_client: ^9.6.8
carousel_slider: ^4.2.1
mqtt_client: ^10.0.0
photo_view: ^0.14.0
confetti: ^0.7.0
flutter_launcher_icons: ^0.10.0 # All but web
flutter_svg_provider: ^1.0.3
flutter_launcher_icons: ^0.13.1 # All but web
flutter_svg_provider: ^1.0.6
openapi_generator_cli: ^4.0.0
openapi_generator: ^4.0.0
openapi_generator_annotations: ^4.0.0
openapi_generator_cli: ^4.13.1
openapi_generator: ^4.13.1
openapi_generator_annotations: ^4.13.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
cupertino_icons: ^1.0.6
manager_api:
path: manager_api
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
openapi_generator: ^4.0.0
openapi_generator: ^4.13.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec