Beacon show popup + update get translate local
This commit is contained in:
parent
3f03f9d77e
commit
30dda83111
@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"flutter_beacon","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_beacon-0.5.1\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler-8.3.0\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"flutter_beacon","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_beacon-0.5.1\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.22\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler-8.3.0\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.7\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.3\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","dependencies":[]},{"name":"just_audio_web","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio_web-0.4.7\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"audio_session","dependencies":[]},{"name":"flutter_beacon","dependencies":[]},{"name":"just_audio","dependencies":["just_audio_web","audio_session","path_provider"]},{"name":"just_audio_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2023-02-15 10:23:40.765589","version":"3.7.0"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"flutter_beacon","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_beacon-0.5.1\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler-8.3.0\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"flutter_beacon","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_beacon-0.5.1\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.22\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler-8.3.0\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","native_build":true,"dependencies":[]},{"name":"just_audio","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio-0.9.31\\\\","native_build":true,"dependencies":["audio_session"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.2.4+1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.7\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.3\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"audio_session","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\audio_session-0.1.13\\\\","dependencies":[]},{"name":"just_audio_web","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\just_audio_web-0.4.7\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"audio_session","dependencies":[]},{"name":"flutter_beacon","dependencies":[]},{"name":"just_audio","dependencies":["just_audio_web","audio_session","path_provider"]},{"name":"just_audio_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2023-02-15 14:23:51.471028","version":"3.7.0"}
|
||||||
@ -37,11 +37,11 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
VisitAppContext visitAppContext = appContext.getContext();
|
VisitAppContext visitAppContext = appContext.getContext();
|
||||||
visitAppContext.configuration = null;
|
visitAppContext.configuration = null;
|
||||||
visitAppContext.isBeaconEnabled = false;
|
visitAppContext.isScanningBeacons = false;
|
||||||
Navigator.of(context).pop();
|
//Navigator.of(context).pop();
|
||||||
/*Navigator.of(context).pushReplacement(MaterialPageRoute(
|
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(
|
||||||
builder: (context) => const HomePage(),
|
builder: (context) => const HomePage(),
|
||||||
));*/
|
),(route) => false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
) : null,
|
) : null,
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
|||||||
VisitAppContext visitAppContext = widget.appContext!.getContext();
|
VisitAppContext visitAppContext = widget.appContext!.getContext();
|
||||||
if(!visitAppContext.sectionIds!.contains(code)) {
|
if(!visitAppContext.sectionIds!.contains(code)) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(TranslationHelper.getFromLocale('invalidQRCode', widget.appContext!)), backgroundColor: kBlue2),
|
SnackBar(content: Text(TranslationHelper.getFromLocale('invalidQRCode', widget.appContext!.getContext())), backgroundColor: kBlue2),
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return ArticlePage(articleId: code);
|
return ArticlePage(visitAppContextIn: visitAppContext, articleId: code);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class _SearchBoxState extends State<SearchBox> {
|
|||||||
enabledBorder: InputBorder.none,
|
enabledBorder: InputBorder.none,
|
||||||
focusedBorder: InputBorder.none,
|
focusedBorder: InputBorder.none,
|
||||||
icon: const Icon(Icons.search, color: Colors.white),
|
icon: const Icon(Icons.search, color: Colors.white),
|
||||||
hintText: TranslationHelper.getFromLocale("search", appContext),
|
hintText: TranslationHelper.getFromLocale("search", appContext.getContext()),
|
||||||
hintStyle: const TextStyle(color: Colors.white),
|
hintStyle: const TextStyle(color: Colors.white),
|
||||||
suffixIcon: _controller.value.text.isNotEmpty ? InkWell(
|
suffixIcon: _controller.value.text.isNotEmpty ? InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@ -18,11 +18,11 @@ void showImagePopup(ImageDTO imageDTO, ResourceModel resourceModel, AppContext a
|
|||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if(TranslationHelper.get(imageDTO.title, appContext).isNotEmpty)
|
if(TranslationHelper.get(imageDTO.title, appContext.getContext()).isNotEmpty)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0, left:8.0, right: 8.0),
|
padding: const EdgeInsets.only(top: 8.0, left:8.0, right: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(imageDTO.title, appContext),
|
TranslationHelper.get(imageDTO.title, appContext.getContext()),
|
||||||
style: const TextStyle(fontSize: kArticleContentSize, fontWeight: FontWeight.w400)),
|
style: const TextStyle(fontSize: kArticleContentSize, fontWeight: FontWeight.w400)),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -210,7 +210,7 @@ class DatabaseHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await DatabaseHelper.instance.queryAllRows(type).then((value) {
|
await DatabaseHelper.instance.queryAllRows(type).then((value) {
|
||||||
print("DB - getData - CONTEXT --- $type --> ");
|
//print("DB - getData - CONTEXT --- $type --> ");
|
||||||
value.forEach((element) {
|
value.forEach((element) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case DatabaseTableType.main:
|
case DatabaseTableType.main:
|
||||||
@ -224,17 +224,17 @@ class DatabaseHelper {
|
|||||||
var test = getConfigurationFromDB(element);
|
var test = getConfigurationFromDB(element);
|
||||||
dataToReturn.add(getConfigurationFromDB(element));
|
dataToReturn.add(getConfigurationFromDB(element));
|
||||||
|
|
||||||
print("DB - dataToReturn --- $test --> ");
|
//print("DB - dataToReturn --- $test --> ");
|
||||||
break;
|
break;
|
||||||
case DatabaseTableType.sections:
|
case DatabaseTableType.sections:
|
||||||
var test = getSectionFromDB(element);
|
var test = getSectionFromDB(element);
|
||||||
dataToReturn.add(getSectionFromDB(element));
|
dataToReturn.add(getSectionFromDB(element));
|
||||||
print("DB - dataToReturn --- $test --> ");
|
//print("DB - dataToReturn --- $test --> ");
|
||||||
break;
|
break;
|
||||||
case DatabaseTableType.resources:
|
case DatabaseTableType.resources:
|
||||||
var test = getResourceFromDB(element);
|
var test = getResourceFromDB(element);
|
||||||
dataToReturn.add(getResourceFromDB(element));
|
dataToReturn.add(getResourceFromDB(element));
|
||||||
print("DB - dataToReturn --- $test --> ");
|
//print("DB - dataToReturn --- $test --> ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
import 'package:mymuseum_visitapp/app_context.dart';
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
import 'package:mymuseum_visitapp/translations.dart';
|
import 'package:mymuseum_visitapp/translations.dart';
|
||||||
|
|
||||||
class TranslationHelper {
|
class TranslationHelper {
|
||||||
static String get(List<TranslationDTO>? translationDTO, AppContext appContext) {
|
static String get(List<TranslationDTO>? translationDTO, VisitAppContext visitAppContext) {
|
||||||
try {
|
try {
|
||||||
return translationDTO!.where((element) => element.language == appContext.getContext().language).first.value!;
|
return translationDTO!.where((element) => element.language == visitAppContext.language).first.value!;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getFromLocale(String valueToGet, AppContext appContext) {
|
static String getFromLocale(String valueToGet, VisitAppContext visitAppContext) {
|
||||||
try {
|
try {
|
||||||
return translations.where((element) => element.language == appContext.getContext().language).first.data![valueToGet]!;
|
return translations.where((element) => element.language == visitAppContext.language).first.data![valueToGet]!;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,21 +4,21 @@ class BeaconSection {
|
|||||||
String? macAddress;
|
String? macAddress;
|
||||||
String? configurationId;
|
String? configurationId;
|
||||||
String? sectionId;
|
String? sectionId;
|
||||||
int? rssi;
|
/*int? rssi;
|
||||||
int? accuracy;
|
int? accuracy;
|
||||||
String? proximityUUID;
|
String? proximityUUID;*/
|
||||||
bool? found = false;
|
bool? found = false;
|
||||||
|
|
||||||
BeaconSection({this.macAddress, this.configurationId, this.sectionId, this.rssi, this.accuracy, this.proximityUUID, this.found});
|
BeaconSection({this.macAddress, this.configurationId, this.sectionId, this.found});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
'macAddress': macAddress,
|
'macAddress': macAddress,
|
||||||
'configurationId': configurationId,
|
'configurationId': configurationId,
|
||||||
'sectionId': sectionId,
|
'sectionId': sectionId,
|
||||||
'rssi': rssi,
|
/*'rssi': rssi,
|
||||||
'accuracy': accuracy,
|
'accuracy': accuracy,
|
||||||
'proximityUUID': proximityUUID,
|
'proximityUUID': proximityUUID,*/
|
||||||
'found': found
|
'found': found
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -28,15 +28,15 @@ class BeaconSection {
|
|||||||
macAddress: json['macAddress'] as String,
|
macAddress: json['macAddress'] as String,
|
||||||
configurationId: json['configurationId'] as String,
|
configurationId: json['configurationId'] as String,
|
||||||
sectionId: json['sectionId'] as String,
|
sectionId: json['sectionId'] as String,
|
||||||
rssi: json['rssi'] as int,
|
/*rssi: json['rssi'] as int,
|
||||||
accuracy: json['accuracy'] as int,
|
accuracy: json['accuracy'] as int,
|
||||||
proximityUUID: json['proximityUUID'] as String,
|
proximityUUID: json['proximityUUID'] as String,*/
|
||||||
found: json['found'] as bool
|
found: json['found'] as bool
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'BeaconSection{macAddress: $macAddress, sectionId: $sectionId, configurationId: $configurationId, rssi: $rssi, accuracy: $accuracy, proximityUUID: $proximityUUID, found: $found}';
|
return 'BeaconSection{macAddress: $macAddress, sectionId: $sectionId, configurationId: $configurationId, found: $found}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,7 +10,9 @@ class VisitAppContext with ChangeNotifier{
|
|||||||
ConfigurationDTO? configuration;
|
ConfigurationDTO? configuration;
|
||||||
List<String?>? sectionIds; // Use to valid QR code found
|
List<String?>? sectionIds; // Use to valid QR code found
|
||||||
List<BeaconSection?>? beaconSections;
|
List<BeaconSection?>? beaconSections;
|
||||||
bool isBeaconEnabled = false;
|
List<SectionDTO?>? currentSections;
|
||||||
|
bool isArticleCurrentlyShown = false;
|
||||||
|
bool isScanningBeacons = false;
|
||||||
|
|
||||||
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
||||||
|
|
||||||
|
|||||||
@ -20,9 +20,10 @@ import 'package:mymuseum_visitapp/constants.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ArticlePage extends StatefulWidget {
|
class ArticlePage extends StatefulWidget {
|
||||||
const ArticlePage({Key? key, required this.articleId}) : super(key: key);
|
const ArticlePage({Key? key, required this.visitAppContextIn, required this.articleId}) : super(key: key);
|
||||||
|
|
||||||
final String articleId;
|
final String articleId;
|
||||||
|
final VisitAppContext visitAppContextIn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ArticlePage> createState() => _ArticlePageState();
|
State<ArticlePage> createState() => _ArticlePageState();
|
||||||
@ -35,6 +36,19 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
ResourceModel? audioResourceModel;
|
ResourceModel? audioResourceModel;
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
late Uint8List audiobytes;
|
late Uint8List audiobytes;
|
||||||
|
VisitAppContext? visitAppContext;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
widget.visitAppContextIn.isArticleCurrentlyShown = true;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
visitAppContext!.isArticleCurrentlyShown = false;
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -42,10 +56,12 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
final notchInset = MediaQuery.of(context).padding;
|
final notchInset = MediaQuery.of(context).padding;
|
||||||
|
|
||||||
|
visitAppContext = appContext.getContext();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: _scaffoldKey,
|
key: _scaffoldKey,
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, appContext) : "",
|
title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, visitAppContext!) : "",
|
||||||
isHomeButton: false,
|
isHomeButton: false,
|
||||||
),
|
),
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
@ -182,7 +198,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(articleDTO!.content, appContext),
|
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: const TextStyle(fontSize: kArticleContentSize)
|
style: const TextStyle(fontSize: kArticleContentSize)
|
||||||
),
|
),
|
||||||
@ -215,7 +231,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(articleDTO!.content, appContext),
|
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: const TextStyle(fontSize: kArticleContentSize)
|
style: const TextStyle(fontSize: kArticleContentSize)
|
||||||
),
|
),
|
||||||
@ -239,7 +255,6 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
List<Map<String, dynamic>> sectionTest = await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.sections, articleId);
|
List<Map<String, dynamic>> sectionTest = await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.sections, articleId);
|
||||||
if(sectionTest.isNotEmpty) {
|
if(sectionTest.isNotEmpty) {
|
||||||
sectionDTO = DatabaseHelper.instance.getSectionFromDB(sectionTest.first);
|
sectionDTO = DatabaseHelper.instance.getSectionFromDB(sectionTest.first);
|
||||||
print("sectionDTO!.datasectionDTO!.datasectionDTO!.datasectionDTO!.data");
|
|
||||||
} else {
|
} else {
|
||||||
print("EMPTY SECTION");
|
print("EMPTY SECTION");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class _AudioPlayerContainerState extends State<AudioPlayerContainer> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: Icon(isplaying?Icons.pause:Icons.play_arrow),
|
icon: Icon(isplaying?Icons.pause:Icons.play_arrow),
|
||||||
label:Text(isplaying?TranslationHelper.getFromLocale("pause", appContext):TranslationHelper.getFromLocale("play", appContext))
|
label:Text(isplaying?TranslationHelper.getFromLocale("pause", appContext.getContext()):TranslationHelper.getFromLocale("play", appContext.getContext()))
|
||||||
),
|
),
|
||||||
|
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
@ -162,7 +162,7 @@ class _AudioPlayerContainerState extends State<AudioPlayerContainer> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.stop),
|
icon: const Icon(Icons.stop),
|
||||||
label: Text(TranslationHelper.getFromLocale("stop", appContext))
|
label: Text(TranslationHelper.getFromLocale("stop", appContext.getContext()))
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,8 +31,7 @@ class ConfigurationsList extends StatefulWidget {
|
|||||||
State<ConfigurationsList> createState() => _ConfigurationsListState();
|
State<ConfigurationsList> createState() => _ConfigurationsListState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBindingObserver {
|
class _ConfigurationsListState extends State<ConfigurationsList> {
|
||||||
final controller = Get.find<RequirementStateController>();
|
|
||||||
List<ConfigurationDTO> configurations = [];
|
List<ConfigurationDTO> configurations = [];
|
||||||
List<String?> alreadyDownloaded = [];
|
List<String?> alreadyDownloaded = [];
|
||||||
VisitAppContext? visitAppContext;
|
VisitAppContext? visitAppContext;
|
||||||
@ -51,14 +50,6 @@ class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBin
|
|||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
visitAppContext = appContext.getContext();
|
visitAppContext = appContext.getContext();
|
||||||
|
|
||||||
|
|
||||||
if(visitAppContext != null) {
|
|
||||||
visitAppContext!.configuration = null;
|
|
||||||
visitAppContext!.isBeaconEnabled = false;
|
|
||||||
print("PAUSE SCAAAAN");
|
|
||||||
controller.pauseScanning();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
shrinkWrap: true, //I've set this as true here depending on what your listview content is
|
shrinkWrap: true, //I've set this as true here depending on what your listview content is
|
||||||
//physics: NeverScrollableScrollPhysics(),//This prevents scrolling, but may inhibit refresh indicator, remove as you need
|
//physics: NeverScrollableScrollPhysics(),//This prevents scrolling, but may inhibit refresh indicator, remove as you need
|
||||||
@ -69,49 +60,48 @@ class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBin
|
|||||||
if(configurations[index].isOffline! && alreadyDownloaded.any((c) => c == configurations[index].id)) {
|
if(configurations[index].isOffline! && alreadyDownloaded.any((c) => c == configurations[index].id)) {
|
||||||
if(!configurations[index].languages!.contains(visitAppContext.language)) {
|
if(!configurations[index].languages!.contains(visitAppContext.language)) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(TranslationHelper.getFromLocale("languageNotSupported", appContext)), backgroundColor: kBlue2),
|
SnackBar(content: Text(TranslationHelper.getFromLocale("languageNotSupported", appContext.getContext())), backgroundColor: kBlue2),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Update context
|
// Update context
|
||||||
visitAppContext.configuration = configurations[index];
|
visitAppContext.configuration = configurations[index];
|
||||||
visitAppContext.sectionIds = configurations[index].sectionIds;
|
visitAppContext.sectionIds = configurations[index].sectionIds;
|
||||||
|
|
||||||
//visitAppContext.sectionIds = List<SectionDTO>.from(await DatabaseHelper.instance.queryWithConfigurationId(DatabaseTableType.sections, visitAppContext.configuration!.id!)).map((e) => e.id).toList();
|
|
||||||
appContext.setContext(visitAppContext);
|
appContext.setContext(visitAppContext);
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||||
|
builder: (context) => VisitPage(configurationId: configurations[index].id!),
|
||||||
|
));
|
||||||
|
/*Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => VisitPage(configurationId: configurations[index].id!)
|
builder: (context) => VisitPage(configurationId: configurations[index].id!)
|
||||||
),
|
),
|
||||||
);
|
);*/
|
||||||
/*Navigator.of(context).pushReplacement(MaterialPageRoute(
|
/**/
|
||||||
builder: (context) => VisitPage(configurationId: configurations[index].id!),
|
|
||||||
));*/
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(configurations[index].isOffline!) {
|
if(configurations[index].isOffline!) {
|
||||||
// Not already downloaded
|
// Not already downloaded
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(TranslationHelper.getFromLocale("visitDownloadWarning", appContext)), backgroundColor: kBlue2),
|
SnackBar(content: Text(TranslationHelper.getFromLocale("visitDownloadWarning", appContext.getContext())), backgroundColor: kBlue2),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Online mode
|
// Online mode
|
||||||
// Update context
|
// Update context
|
||||||
visitAppContext.configuration = configurations[index];
|
visitAppContext.configuration = configurations[index];
|
||||||
//List<SectionDTO>? sections = await ApiService.getAllSections(appContext.clientAPI, visitAppContext.configuration!.id!);
|
|
||||||
visitAppContext.sectionIds = configurations[index].sectionIds;
|
visitAppContext.sectionIds = configurations[index].sectionIds;
|
||||||
|
|
||||||
Navigator.push(
|
/*Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => VisitPage(configurationId: configurations[index].id!)
|
builder: (context) => VisitPage(configurationId: configurations[index].id!)
|
||||||
),
|
),
|
||||||
);
|
);*/
|
||||||
|
|
||||||
/*Navigator.of(context).pushReplacement(MaterialPageRoute(
|
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||||
builder: (context) => VisitPage(configurationId: configurations[index].id!),
|
builder: (context) => VisitPage(configurationId: configurations[index].id!),
|
||||||
));*/
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -159,7 +149,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBin
|
|||||||
),
|
),
|
||||||
) : const Text("");
|
) : const Text("");
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
return Text(TranslationHelper.getFromLocale("noData", appContext));
|
return Text(TranslationHelper.getFromLocale("noData", appContext.getContext()));
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -179,7 +169,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBin
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10),
|
padding: const EdgeInsets.only(left: 10),
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
TranslationHelper.get(configurations[index].title, appContext),
|
TranslationHelper.get(configurations[index].title, appContext.getContext()),
|
||||||
style: const TextStyle(fontSize: kMenuTitleDetailSize),
|
style: const TextStyle(fontSize: kMenuTitleDetailSize),
|
||||||
maxFontSize: 18,
|
maxFontSize: 18,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
@ -223,7 +213,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> with WidgetsBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> downloadClicked(AppContext appContext, ConfigurationDTO configuration) async {
|
Future<void> downloadClicked(AppContext appContext, ConfigurationDTO configuration) async {
|
||||||
String loadingtext = TranslationHelper.getFromLocale("downloadConfiguration", appContext);
|
String loadingtext = TranslationHelper.getFromLocale("downloadConfiguration", appContext.getContext());
|
||||||
showDialog(
|
showDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
title: TranslationHelper.getFromLocale("visitTitle", appContext),
|
title: TranslationHelper.getFromLocale("visitTitle", appContext.getContext()),
|
||||||
isHomeButton: false,
|
isHomeButton: false,
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
@ -72,7 +72,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
return Text(TranslationHelper.getFromLocale("noData", appContext));
|
return Text(TranslationHelper.getFromLocale("noData", appContext.getContext()));
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -123,12 +123,9 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|||||||
configurations = List<ConfigurationDTO>.from(await DatabaseHelper.instance.getData(DatabaseTableType.configurations));
|
configurations = List<ConfigurationDTO>.from(await DatabaseHelper.instance.getData(DatabaseTableType.configurations));
|
||||||
alreadyDownloaded = configurations.map((c) => c.id).toList();
|
alreadyDownloaded = configurations.map((c) => c.id).toList();
|
||||||
|
|
||||||
print("alreadyDownloadedalreadyDownloadedalreadyDownloadedalreadyDownloadedalreadyDownloadedalreadyDownloaded");
|
|
||||||
print(alreadyDownloaded);
|
|
||||||
|
|
||||||
if(!isOnline) {
|
if(!isOnline) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(TranslationHelper.getFromLocale("noInternet", appContext)), backgroundColor: kBlue2),
|
SnackBar(content: Text(TranslationHelper.getFromLocale("noInternet", appContext.getContext())), backgroundColor: kBlue2),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO HANDLE BEACON IN LOCAL (CREATE TABLE)
|
// TODO HANDLE BEACON IN LOCAL (CREATE TABLE)
|
||||||
|
|||||||
@ -4,7 +4,9 @@ import 'dart:io';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mymuseum_visitapp/Components/CustomAppBar.dart';
|
import 'package:mymuseum_visitapp/Components/CustomAppBar.dart';
|
||||||
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
|
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
|
||||||
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
import 'package:qr_code_scanner/qr_code_scanner.dart';
|
import 'package:qr_code_scanner/qr_code_scanner.dart';
|
||||||
|
|
||||||
// NOT USED ANYMORE
|
// NOT USED ANYMORE
|
||||||
@ -178,7 +180,7 @@ class _ScannerPageState extends State<ScannerPage> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return ArticlePage(articleId: code);
|
return ArticlePage(articleId: code, visitAppContextIn: VisitAppContext()); // will not work..
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:mymuseum_visitapp/Components/Loading.dart';
|
import 'package:mymuseum_visitapp/Components/Loading.dart';
|
||||||
@ -6,11 +8,14 @@ import 'package:mymuseum_visitapp/Components/SearchNumberBox.dart';
|
|||||||
import 'package:mymuseum_visitapp/Helpers/DatabaseHelper.dart';
|
import 'package:mymuseum_visitapp/Helpers/DatabaseHelper.dart';
|
||||||
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
|
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
|
||||||
import 'package:mymuseum_visitapp/Models/beaconSection.dart';
|
import 'package:mymuseum_visitapp/Models/beaconSection.dart';
|
||||||
|
import 'package:mymuseum_visitapp/Models/resourceModel.dart';
|
||||||
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
|
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
|
||||||
import 'package:mymuseum_visitapp/Services/apiService.dart';
|
import 'package:mymuseum_visitapp/Services/apiService.dart';
|
||||||
import 'package:mymuseum_visitapp/app_context.dart';
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
|
import 'package:mymuseum_visitapp/client.dart';
|
||||||
import 'package:mymuseum_visitapp/constants.dart';
|
import 'package:mymuseum_visitapp/constants.dart';
|
||||||
|
import 'package:photo_view/photo_view.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class BeaconArticleFound extends StatefulWidget {
|
class BeaconArticleFound extends StatefulWidget {
|
||||||
@ -23,30 +28,108 @@ class BeaconArticleFound extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BeaconArticleFoundState extends State<BeaconArticleFound> {
|
class _BeaconArticleFoundState extends State<BeaconArticleFound> {
|
||||||
|
VisitAppContext? visitAppContext;
|
||||||
|
SectionDTO? sectionFound;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Container(
|
visitAppContext = appContext.getContext();
|
||||||
height: size.height *0.5,
|
|
||||||
width: size.width *0.9,
|
if(widget.beaconSection != null && visitAppContext!.currentSections != null && visitAppContext!.currentSections!.isNotEmpty)
|
||||||
child: Stack(
|
{
|
||||||
children: [
|
var testSection = visitAppContext!.currentSections!.where((section) => section!.id.toString() == widget.beaconSection!.sectionId.toString()).toList();
|
||||||
Center(
|
sectionFound = testSection.isNotEmpty ? testSection.first : null;
|
||||||
child: Text(
|
}
|
||||||
widget.beaconSection!.macAddress!,
|
|
||||||
)
|
return FutureBuilder(
|
||||||
),
|
future: getSectionImage(appContext, appContext.clientAPI, sectionFound),
|
||||||
Positioned(
|
builder: (context, AsyncSnapshot<ResourceModel?> snapshot) {
|
||||||
top: 0,
|
return SizedBox(
|
||||||
right: 0,
|
height: size.height *0.4,
|
||||||
child: Text('close')
|
width: size.width *0.9,
|
||||||
)
|
child: Center(
|
||||||
],
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
);
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if(snapshot.data != null)
|
||||||
|
SizedBox(
|
||||||
|
height: size.height * 0.25,
|
||||||
|
width: size.width * 0.75,
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||||
|
child: visitAppContext!.configuration!.isOffline! ?
|
||||||
|
Image.memory(
|
||||||
|
base64Decode(snapshot.data!.data!),
|
||||||
|
fit: BoxFit.cover
|
||||||
|
) :
|
||||||
|
Image.network(
|
||||||
|
snapshot.data!.source!,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
|
ImageChunkEvent? loadingProgress) {
|
||||||
|
if (loadingProgress == null) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: kBlue1,
|
||||||
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
|
? loadingProgress.cumulativeBytesLoaded /
|
||||||
|
loadingProgress.expectedTotalBytes!
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
TranslationHelper.get(sectionFound!.title, appContext.getContext()), style: TextStyle(fontSize: kMenuTitleDetailSize), textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
/*Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text("Non"),
|
||||||
|
Text("Ouvrir")
|
||||||
|
],
|
||||||
|
)*/
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ResourceModel?> getSectionImage(AppContext appContext, Client clientAPI, SectionDTO? sectionFound) async {
|
||||||
|
if(sectionFound == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
bool isConfigOffline = (appContext.getContext() as VisitAppContext).configuration!.isOffline!;
|
||||||
|
if(isConfigOffline) {
|
||||||
|
List<Map<String, dynamic>> resource = await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, sectionFound.imageId!);
|
||||||
|
if(resource.isNotEmpty) {
|
||||||
|
return DatabaseHelper.instance.getResourceFromDB(resource.first);
|
||||||
|
} else {
|
||||||
|
print("EMPTY resourcesModel - getSectionImage");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,6 +103,7 @@ class _BodyState extends State<Body> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => ArticlePage(
|
builder: (context) => ArticlePage(
|
||||||
|
visitAppContextIn: appContext.getContext(),
|
||||||
articleId: sectionsToDisplay[index].id!,
|
articleId: sectionsToDisplay[index].id!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -113,7 +114,7 @@ class _BodyState extends State<Body> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
return Text(TranslationHelper.getFromLocale("noData", appContext));
|
return Text(TranslationHelper.getFromLocale("noData", appContext.getContext()));
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -133,7 +134,8 @@ class _BodyState extends State<Body> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSections(AppContext appContext) async {
|
getSections(AppContext appContext) async {
|
||||||
if((appContext.getContext() as VisitAppContext).configuration!.isOffline!)
|
VisitAppContext visitAppContext = (appContext.getContext() as VisitAppContext);
|
||||||
|
if(visitAppContext.configuration!.isOffline!)
|
||||||
{
|
{
|
||||||
// OFFLINE
|
// OFFLINE
|
||||||
sections = List<SectionDTO>.from(await DatabaseHelper.instance.getData(DatabaseTableType.sections));
|
sections = List<SectionDTO>.from(await DatabaseHelper.instance.getData(DatabaseTableType.sections));
|
||||||
@ -141,7 +143,7 @@ class _BodyState extends State<Body> {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ONLINE
|
// ONLINE
|
||||||
List<SectionDTO>? sectionsDownloaded = await ApiService.getAllSections(appContext.clientAPI, (appContext.getContext() as VisitAppContext).configuration!.id!);
|
List<SectionDTO>? sectionsDownloaded = await ApiService.getAllSections(appContext.clientAPI, visitAppContext.configuration!.id!);
|
||||||
print(sectionsDownloaded);
|
print(sectionsDownloaded);
|
||||||
if(sectionsDownloaded!.isNotEmpty) {
|
if(sectionsDownloaded!.isNotEmpty) {
|
||||||
sections = sectionsDownloaded.where((s) => s.type == SectionType.Article).toList(); // HERE TODO IF support more than article type
|
sections = sectionsDownloaded.where((s) => s.type == SectionType.Article).toList(); // HERE TODO IF support more than article type
|
||||||
@ -153,8 +155,10 @@ class _BodyState extends State<Body> {
|
|||||||
sections.sort((a,b) => a.order!.compareTo(b.order!));
|
sections.sort((a,b) => a.order!.compareTo(b.order!));
|
||||||
sectionsToDisplay = sections;
|
sectionsToDisplay = sections;
|
||||||
|
|
||||||
|
visitAppContext.currentSections = sectionsToDisplay;
|
||||||
|
|
||||||
if(searchValue != '' && searchValue != null) {
|
if(searchValue != '' && searchValue != null) {
|
||||||
sectionsToDisplay = sections.where((s) => TranslationHelper.get(s.title, appContext).toLowerCase().contains(searchValue.toString().toLowerCase())).toList();
|
sectionsToDisplay = sections.where((s) => TranslationHelper.get(s.title, appContext.getContext()).toLowerCase().contains(searchValue.toString().toLowerCase())).toList();
|
||||||
} else {
|
} else {
|
||||||
if(searchNumberValue != null) {
|
if(searchNumberValue != null) {
|
||||||
sectionsToDisplay = sections.where((s) => s.order!+1 == searchNumberValue).toList();
|
sectionsToDisplay = sections.where((s) => s.order!+1 == searchNumberValue).toList();
|
||||||
|
|||||||
@ -81,37 +81,35 @@ class SectionCard extends StatelessWidget {
|
|||||||
future: ApiService.getResource(appContext, sectionDTO.imageId!),
|
future: ApiService.getResource(appContext, sectionDTO.imageId!),
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
return snapshot.data != null ? Container(
|
return snapshot.data != null ? ClipRRect(
|
||||||
child: ClipRRect(
|
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||||
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
|
child: isOffline ?
|
||||||
child: isOffline ?
|
Image.memory(
|
||||||
Image.memory(
|
base64Decode(snapshot.data!.data!),
|
||||||
base64Decode(snapshot.data!.data!),
|
fit: BoxFit.cover
|
||||||
fit: BoxFit.cover
|
) :
|
||||||
) :
|
Image.network(
|
||||||
Image.network(
|
sectionDTO.imageSource!,
|
||||||
sectionDTO.imageSource!,
|
fit: BoxFit.cover,
|
||||||
fit: BoxFit.cover,
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
loadingBuilder: (BuildContext context, Widget child,
|
ImageChunkEvent? loadingProgress) {
|
||||||
ImageChunkEvent? loadingProgress) {
|
if (loadingProgress == null) {
|
||||||
if (loadingProgress == null) {
|
return child;
|
||||||
return child;
|
}
|
||||||
}
|
return Center(
|
||||||
return Center(
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
color: kBlue1,
|
||||||
color: kBlue1,
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
value: loadingProgress.expectedTotalBytes != null
|
? loadingProgress.cumulativeBytesLoaded /
|
||||||
? loadingProgress.cumulativeBytesLoaded /
|
loadingProgress.expectedTotalBytes!
|
||||||
loadingProgress.expectedTotalBytes!
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
) : const Text("");
|
) : const Text("");
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
return Text(TranslationHelper.getFromLocale("noData", appContext));
|
return Text(TranslationHelper.getFromLocale("noData", appContext.getContext()));
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -140,7 +138,7 @@ class SectionCard extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
|
padding: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(sectionDTO.title, appContext),
|
TranslationHelper.get(sectionDTO.title, appContext.getContext()),
|
||||||
style: Theme.of(context).textTheme.button,
|
style: Theme.of(context).textTheme.button,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import 'package:mymuseum_visitapp/Helpers/requirement_state_controller.dart';
|
|||||||
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
|
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
|
||||||
import 'package:mymuseum_visitapp/Models/beaconSection.dart';
|
import 'package:mymuseum_visitapp/Models/beaconSection.dart';
|
||||||
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
|
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
|
||||||
import 'package:mymuseum_visitapp/Screens/Visit/beaconArticleFound.dart';
|
import 'package:mymuseum_visitapp/Screens/Visit/beaconArticleFound.dart';
|
||||||
import 'package:mymuseum_visitapp/app_context.dart';
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
import 'package:mymuseum_visitapp/constants.dart';
|
import 'package:mymuseum_visitapp/constants.dart';
|
||||||
@ -32,13 +33,17 @@ class VisitPage extends StatefulWidget {
|
|||||||
class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
||||||
ConfigurationDTO? configuration;
|
ConfigurationDTO? configuration;
|
||||||
|
|
||||||
|
int timeBetweenBeaconPopUp = 25000; // 25 sec
|
||||||
|
|
||||||
// Beacon specific
|
// Beacon specific
|
||||||
final controller = Get.find<RequirementStateController>();
|
final controller = Get.find<RequirementStateController>();
|
||||||
StreamSubscription<BluetoothState>? _streamBluetooth;
|
StreamSubscription<BluetoothState>? _streamBluetooth;
|
||||||
StreamSubscription<RangingResult>? _streamRanging;
|
StreamSubscription<RangingResult>? _streamRanging;
|
||||||
final _regionBeacons = <Region, List<Beacon>>{};
|
/*final _regionBeacons = <Region, List<Beacon>>{};
|
||||||
final _beacons = <Beacon>[];
|
final _beacons = <Beacon>[];*/
|
||||||
bool _isDialogShowing = false;
|
bool _isDialogShowing = false;
|
||||||
|
DateTime? lastTimePopUpWasClosed;
|
||||||
|
//bool _isArticleOpened = false;
|
||||||
StreamSubscription? listener;
|
StreamSubscription? listener;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,7 +51,6 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
listeningState();
|
listeningState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +101,6 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
].request();
|
].request();
|
||||||
print(statuses[Permission.bluetoothScan]);
|
print(statuses[Permission.bluetoothScan]);
|
||||||
print(statuses[Permission.bluetoothConnect]);
|
print(statuses[Permission.bluetoothConnect]);
|
||||||
|
|
||||||
print(status);
|
print(status);
|
||||||
|
|
||||||
/*controller.startStream.listen((flag) {
|
/*controller.startStream.listen((flag) {
|
||||||
@ -153,21 +156,29 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
print(result.beacons.map((b) => b.macAddress));
|
print(result.beacons.map((b) => b.macAddress));
|
||||||
print(visitAppContext.beaconSections!.map((bb) => bb!.macAddress));
|
print(visitAppContext.beaconSections!.map((bb) => bb!.macAddress));
|
||||||
|
|
||||||
var beaconList = visitAppContext.beaconSections!.where((bs) => result.beacons.any((element) => element.macAddress == bs!.macAddress));
|
var beaconList = visitAppContext.beaconSections!.where((bs) => result.beacons.any((element) => element.macAddress == bs!.macAddress && element.accuracy < 15)); // less than 15 meter away
|
||||||
if(beaconList.isNotEmpty)
|
if(beaconList.isNotEmpty)
|
||||||
{
|
{
|
||||||
print("GOT ONE BEACON THAT I KNOOOOOOOOW");
|
print("GOT ONE BEACON THAT I KNOOOOOOOOW");
|
||||||
print(beaconList);
|
print(beaconList);
|
||||||
|
|
||||||
// TODO SORT BY COMPARE
|
var milliLastTime = lastTimePopUpWasClosed == null ? 0 : lastTimePopUpWasClosed!.millisecondsSinceEpoch;
|
||||||
|
var checkIfMoreThanSec = (DateTime.now().millisecondsSinceEpoch - milliLastTime) > timeBetweenBeaconPopUp;
|
||||||
|
|
||||||
if(!_isDialogShowing) {
|
if(!_isDialogShowing && !visitAppContext.isArticleCurrentlyShown && checkIfMoreThanSec && visitAppContext.isScanningBeacons) {
|
||||||
_onBeaconFound(visitAppContext, beaconList.first!);
|
print("CONFIGURATIOON");
|
||||||
|
print(visitAppContext.configuration!.id);
|
||||||
|
|
||||||
|
var beaconListConfig = beaconList.where((beacon) => beacon!.configurationId == visitAppContext.configuration!.id!);
|
||||||
|
|
||||||
|
print("AFTERRRR");
|
||||||
|
print(beaconListConfig);
|
||||||
|
|
||||||
|
_onBeaconFound(visitAppContext, beaconListConfig.first);
|
||||||
} else {
|
} else {
|
||||||
print("Already showing làà");
|
print("Non pas possible d'afficher pour le moment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//print("BEFORE SNACKBAR");
|
//print("BEFORE SNACKBAR");
|
||||||
/*ScaffoldMessenger.of(context).showSnackBar(
|
/*ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text('BEACON - ${result.beacons.first.macAddress} - ${result.beacons.first.accuracy} - ${result.beacons.first.proximity.name}'), backgroundColor: kBlue2),
|
SnackBar(content: Text('BEACON - ${result.beacons.first.macAddress} - ${result.beacons.first.accuracy} - ${result.beacons.first.proximity.name}'), backgroundColor: kBlue2),
|
||||||
@ -227,23 +238,7 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
void _onBeaconFound(VisitAppContext visitAppContext, BeaconSection? beaconSection) {
|
||||||
/*Widget build(BuildContext context) {
|
|
||||||
return new WillPopScope(
|
|
||||||
onWillPop: () async => false,
|
|
||||||
child: new Scaffold(
|
|
||||||
appBar: new AppBar(
|
|
||||||
title: new Text("data"),
|
|
||||||
leading: new IconButton(
|
|
||||||
icon: new Icon(Icons.ac_unit),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void _onBeaconFound(VisitAppContext visitAppContext, BeaconSection beaconSection) {
|
|
||||||
_isDialogShowing = true;
|
_isDialogShowing = true;
|
||||||
showDialog(
|
showDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@ -254,13 +249,33 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
content: BeaconArticleFound(beaconSection: beaconSection),
|
content: BeaconArticleFound(beaconSection: beaconSection),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text("CANCEL"),
|
child: Text(TranslationHelper.getFromLocale("close", visitAppContext), style: TextStyle(color: kMainColor)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_isDialogShowing = false; // set it `false` since dialog is closed
|
_isDialogShowing = false; // set it `false` since dialog is closed
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
lastTimePopUpWasClosed = DateTime.now();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text(TranslationHelper.getFromLocale("open", visitAppContext), style: TextStyle(color: kMainColor)),
|
||||||
|
onPressed: () {
|
||||||
|
_isDialogShowing = false; // set it `false` since dialog is closed
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
//visitAppContext.isArticleCurrentlyShown = true;
|
||||||
|
lastTimePopUpWasClosed = DateTime.now();
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => ArticlePage(
|
||||||
|
visitAppContextIn: visitAppContext,
|
||||||
|
articleId: beaconSection!.sectionId!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
actionsAlignment: MainAxisAlignment.spaceAround,
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
), context: context
|
), context: context
|
||||||
);
|
);
|
||||||
@ -271,32 +286,34 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onDispose() {
|
void dispose() {
|
||||||
print("DISPOSE VISIT PAGE");
|
print("DISPOSE VISIT PAGE -------------------------------");
|
||||||
|
/*listener = null;
|
||||||
|
controller.dispose();
|
||||||
|
WidgetsBinding.instance.removeObserver(this);*/
|
||||||
|
controller.pauseScanning();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
VisitAppContext visitAppContext = appContext.getContext();
|
VisitAppContext visitAppContext = appContext.getContext();
|
||||||
configuration = visitAppContext.configuration;
|
configuration = visitAppContext.configuration;
|
||||||
|
|
||||||
//if(visitAppContext.isBeaconEnabled) {
|
listener = controller.startStream.listen((flag) async {
|
||||||
listener = controller.startStream.listen((flag) async {
|
print(flag);
|
||||||
print(flag);
|
if (flag == true) {
|
||||||
if (flag == true) {
|
print("FIIIIIIREEEE ---------------");
|
||||||
print("FIIIIIIREEEE ---------------");
|
await initScanBeacon(visitAppContext);
|
||||||
await initScanBeacon(visitAppContext);
|
controller.startScanning();
|
||||||
controller.startScanning();
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
//}
|
|
||||||
|
|
||||||
return /*WillPopScope(
|
return WillPopScope(
|
||||||
child:*/ Scaffold(
|
child: Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
title: TranslationHelper.get(configuration!.title, appContext),
|
title: TranslationHelper.get(configuration!.title, visitAppContext),
|
||||||
isHomeButton: true,
|
isHomeButton: true,
|
||||||
),
|
),
|
||||||
backgroundColor: kBackgroundGrey,
|
backgroundColor: kBackgroundGrey,
|
||||||
@ -313,30 +330,28 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: FloatingActionButton(
|
child: FloatingActionButton(
|
||||||
heroTag: "beacon",
|
heroTag: "beacon",
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
setState(() {
|
if(!visitAppContext.isScanningBeacons) {
|
||||||
if(!visitAppContext.isBeaconEnabled) {
|
print("Start Scan");
|
||||||
print("Start Scan");
|
print(_streamRanging);
|
||||||
controller.startScanning();
|
if (_streamRanging != null) {
|
||||||
listener!.resume();
|
_streamRanging?.resume();
|
||||||
|
|
||||||
visitAppContext.isBeaconEnabled = true;
|
|
||||||
appContext.setContext(visitAppContext);
|
|
||||||
} else {
|
} else {
|
||||||
print("Pause Scan");
|
await initScanBeacon(visitAppContext);
|
||||||
controller.pauseScanning(); // PAUSE OR DISPOSE ?
|
|
||||||
//controller.dispose(); // PAUSE OR DISPOSE ?
|
|
||||||
print(controller.pauseStream);
|
|
||||||
listener!.cancel();
|
|
||||||
listener!.pause();
|
|
||||||
//controller.removeListenerId(listener.i, () { });
|
|
||||||
visitAppContext.isBeaconEnabled = false;
|
|
||||||
appContext.setContext(visitAppContext);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
controller.startScanning();
|
||||||
|
visitAppContext.isScanningBeacons = true;
|
||||||
|
appContext.setContext(visitAppContext);
|
||||||
|
} else {
|
||||||
|
print("Pause Scan");
|
||||||
|
controller.pauseScanning(); // PAUSE OR DISPOSE ?
|
||||||
|
visitAppContext.isScanningBeacons = false;
|
||||||
|
appContext.setContext(visitAppContext);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tooltip: 'Beacon',
|
tooltip: 'Beacon',
|
||||||
backgroundColor: visitAppContext.isBeaconEnabled ? kBlue1 : Colors.grey,
|
backgroundColor: visitAppContext.isScanningBeacons ? kBlue1 : Colors.grey,
|
||||||
child: const Icon(Icons.my_location),
|
child: const Icon(Icons.my_location),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -348,30 +363,10 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
child: ScannerBouton(appContext: appContext),
|
child: ScannerBouton(appContext: appContext),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),/*Padding(
|
),
|
||||||
padding: const EdgeInsets.only(right: 10),
|
),
|
||||||
child: Row(
|
onWillPop: () async => false,
|
||||||
children: [
|
);
|
||||||
Container(
|
|
||||||
height: 65.0,
|
|
||||||
width: 65.0,
|
|
||||||
child: FittedBox(
|
|
||||||
child: FloatingActionButton(
|
|
||||||
heroTag: "beacon",
|
|
||||||
onPressed: () {},
|
|
||||||
tooltip: 'Beacon',
|
|
||||||
backgroundColor: kBlue1,
|
|
||||||
child: const Icon(Icons.qr_code_scanner),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ScannerBouton(appContext: appContext),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
);//,
|
|
||||||
//onWillPop: () async => false,
|
|
||||||
//);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOpenLocationSettings() async {
|
handleOpenLocationSettings() async {
|
||||||
|
|||||||
@ -12,7 +12,9 @@ List<Translation> translations = [
|
|||||||
"search": "Rechercher",
|
"search": "Rechercher",
|
||||||
"play": "Lecture",
|
"play": "Lecture",
|
||||||
"pause": "Pause",
|
"pause": "Pause",
|
||||||
"stop": "Arrêt"
|
"stop": "Arrêt",
|
||||||
|
"open": "Ouvrir",
|
||||||
|
"close": "Fermer"
|
||||||
}),
|
}),
|
||||||
Translation(language: "EN", data: {
|
Translation(language: "EN", data: {
|
||||||
"visitTitle": "List of tours",
|
"visitTitle": "List of tours",
|
||||||
@ -25,7 +27,9 @@ List<Translation> translations = [
|
|||||||
"search": "Search",
|
"search": "Search",
|
||||||
"play": "Play",
|
"play": "Play",
|
||||||
"pause": "Pause",
|
"pause": "Pause",
|
||||||
"stop": "Stop"
|
"stop": "Stop",
|
||||||
|
"open": "Open",
|
||||||
|
"close": "Close"
|
||||||
}),
|
}),
|
||||||
Translation(language: "DE", data: {
|
Translation(language: "DE", data: {
|
||||||
"visitTitle": "Liste der Touren",
|
"visitTitle": "Liste der Touren",
|
||||||
@ -38,7 +42,9 @@ List<Translation> translations = [
|
|||||||
"search": "Suche",
|
"search": "Suche",
|
||||||
"play": "Spiel",
|
"play": "Spiel",
|
||||||
"pause": "Pause",
|
"pause": "Pause",
|
||||||
"stop": "Stopp"
|
"stop": "Stopp",
|
||||||
|
"open": "Offen",
|
||||||
|
"close": "Schließen"
|
||||||
}),
|
}),
|
||||||
Translation(language: "NL", data: {
|
Translation(language: "NL", data: {
|
||||||
"visitTitle": "Lijst met rondleidingen",
|
"visitTitle": "Lijst met rondleidingen",
|
||||||
@ -51,7 +57,9 @@ List<Translation> translations = [
|
|||||||
"search": "Zoeken",
|
"search": "Zoeken",
|
||||||
"play": "Speel",
|
"play": "Speel",
|
||||||
"pause": "Pauze",
|
"pause": "Pauze",
|
||||||
"stop": "Stop"
|
"stop": "Stop",
|
||||||
|
"open": "Open",
|
||||||
|
"close": "Sluiten"
|
||||||
}),
|
}),
|
||||||
Translation(language: "IT", data: {
|
Translation(language: "IT", data: {
|
||||||
"visitTitle": "Elenco dei tour",
|
"visitTitle": "Elenco dei tour",
|
||||||
@ -64,7 +72,9 @@ List<Translation> translations = [
|
|||||||
"search": "Ricerca",
|
"search": "Ricerca",
|
||||||
"play": "Giocare a",
|
"play": "Giocare a",
|
||||||
"pause": "Pausa",
|
"pause": "Pausa",
|
||||||
"stop": "Fermare"
|
"stop": "Fermare",
|
||||||
|
"open": "Aprire",
|
||||||
|
"close": "Chiudere"
|
||||||
}),
|
}),
|
||||||
Translation(language: "ES", data: {
|
Translation(language: "ES", data: {
|
||||||
"visitTitle": "Lista de recorridos",
|
"visitTitle": "Lista de recorridos",
|
||||||
@ -77,7 +87,9 @@ List<Translation> translations = [
|
|||||||
"search": "Búsqueda",
|
"search": "Búsqueda",
|
||||||
"play": "Tocar",
|
"play": "Tocar",
|
||||||
"pause": "Pausa",
|
"pause": "Pausa",
|
||||||
"stop": "Parada"
|
"stop": "Parada",
|
||||||
|
"open": "Abrir",
|
||||||
|
"close": "Cerca"
|
||||||
}),
|
}),
|
||||||
Translation(language: "PL", data: {
|
Translation(language: "PL", data: {
|
||||||
"visitTitle": "Lista wycieczek",
|
"visitTitle": "Lista wycieczek",
|
||||||
@ -90,7 +102,9 @@ List<Translation> translations = [
|
|||||||
"search": "Szukaj",
|
"search": "Szukaj",
|
||||||
"play": "Bawić się",
|
"play": "Bawić się",
|
||||||
"pause": "Pauza",
|
"pause": "Pauza",
|
||||||
"stop": "Stop"
|
"stop": "Stop",
|
||||||
|
"open": "Otwarty",
|
||||||
|
"close": "Zamknąć"
|
||||||
}),
|
}),
|
||||||
Translation(language: "CN", data: {
|
Translation(language: "CN", data: {
|
||||||
"visitTitle": "旅游清单",
|
"visitTitle": "旅游清单",
|
||||||
@ -103,7 +117,9 @@ List<Translation> translations = [
|
|||||||
"search": "搜索",
|
"search": "搜索",
|
||||||
"play": "玩",
|
"play": "玩",
|
||||||
"pause": "暫停",
|
"pause": "暫停",
|
||||||
"stop": "停止"
|
"stop": "停止",
|
||||||
|
"open": "打开",
|
||||||
|
"close": "关闭"
|
||||||
}),
|
}),
|
||||||
Translation(language: "UK", data: {
|
Translation(language: "UK", data: {
|
||||||
"visitTitle": "Список турів",
|
"visitTitle": "Список турів",
|
||||||
@ -116,7 +132,9 @@ List<Translation> translations = [
|
|||||||
"search": "Пошук",
|
"search": "Пошук",
|
||||||
"play": "грати",
|
"play": "грати",
|
||||||
"pause": "Пауза",
|
"pause": "Пауза",
|
||||||
"stop": "Стоп"
|
"stop": "Стоп",
|
||||||
|
"open": "ВІДЧИНЕНО",
|
||||||
|
"close": "Закрити"
|
||||||
}),
|
}),
|
||||||
Translation(language: "AR", data: {
|
Translation(language: "AR", data: {
|
||||||
"visitTitle": "قائمة الجولات",
|
"visitTitle": "قائمة الجولات",
|
||||||
@ -129,6 +147,8 @@ List<Translation> translations = [
|
|||||||
"search": "يبحث",
|
"search": "يبحث",
|
||||||
"play": "لعب",
|
"play": "لعب",
|
||||||
"pause": "وقفة",
|
"pause": "وقفة",
|
||||||
"stop": "قف"
|
"stop": "قف",
|
||||||
|
"open": "يفتح",
|
||||||
|
"close": "يغلق"
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
Loading…
x
Reference in New Issue
Block a user