Translations of common elements + update layout

This commit is contained in:
Fransolet Thomas 2022-09-10 23:01:27 +02:00
parent 7ed3db47e0
commit 329f9299c5
24 changed files with 174 additions and 434 deletions

View File

@ -1,3 +1,3 @@
# This is a generated file; do not edit or check into version control.
qr_code_scanner=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\qr_code_scanner-1.0.0\\
qr_code_scanner=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\qr_code_scanner-1.0.1\\
sqflite=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\sqflite-2.0.3+1\\

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-09-10 18:06:46.514323","version":"3.0.3"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-09-10 22:13:09.391856","version":"3.0.3"}

View File

@ -3,43 +3,44 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2022-09-03 17:19:05.522230.
_fe_analyzer_shared:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-31.0.0/lib/
analyzer:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/analyzer-2.8.0/lib/
# Generated by pub on 2022-09-10 22:13:09.133757.
_fe_analyzer_shared:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-47.0.0/lib/
analyzer:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/analyzer-4.7.0/lib/
args:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/args-2.3.1/lib/
async:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/async-2.8.2/lib/
auto_size_text:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/auto_size_text-3.0.0/lib/
boolean_selector:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
build:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build-2.0.3/lib/
build_config:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_config-0.4.7/lib/
build_daemon:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_daemon-2.1.10/lib/
build_resolvers:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/
build_runner:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_runner-1.12.2/lib/
build_runner_core:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_runner_core-6.1.12/lib/
build:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build-2.3.0/lib/
build_config:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_config-1.1.0/lib/
build_daemon:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_daemon-3.1.0/lib/
build_resolvers:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_resolvers-2.0.9/lib/
build_runner:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_runner-2.2.0/lib/
build_runner_core:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/build_runner_core-7.2.3/lib/
built_collection:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/built_collection-5.1.1/lib/
built_value:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/built_value-8.4.0/lib/
built_value:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/built_value-8.4.1/lib/
carousel_slider:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/carousel_slider-4.1.1/lib/
characters:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/characters-1.2.0/lib/
charcode:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/charcode-1.3.1/lib/
checked_yaml:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/checked_yaml-2.0.1/lib/
cli_util:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/cli_util-0.3.5/lib/
clock:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
code_builder:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/code_builder-3.7.0/lib/
code_builder:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/code_builder-4.2.0/lib/
collection:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/collection-1.16.0/lib/
convert:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/convert-3.0.2/lib/
crypto:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/crypto-3.0.2/lib/
cupertino_icons:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/cupertino_icons-1.0.5/lib/
dart_style:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dart_style-2.2.1/lib/
dart_style:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dart_style-2.2.3/lib/
fake_async:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/fake_async-1.3.0/lib/
file:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/file-6.1.2/lib/
file:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/file-6.1.4/lib/
fixnum:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/fixnum-1.0.1/lib/
flutter:file:///C:/Users/thoma/Documents/flutter/packages/flutter/lib/
flutter_lints:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_lints-1.0.4/lib/
flutter_svg:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_svg-1.1.3/lib/
flutter_localizations:file:///C:/Users/thoma/Documents/flutter/packages/flutter_localizations/lib/
flutter_svg:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_svg-1.1.5/lib/
flutter_test:file:///C:/Users/thoma/Documents/flutter/packages/flutter_test/lib/
flutter_web_plugins:file:///C:/Users/thoma/Documents/flutter/packages/flutter_web_plugins/lib/
frontend_server_client:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/frontend_server_client-2.1.3/lib/
glob:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/glob-2.1.0/lib/
graphs:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/graphs-1.0.0/lib/
graphs:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/graphs-2.1.0/lib/
http:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http-0.13.5/lib/
http_multi_server:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http_multi_server-3.2.1/lib/
http_parser:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http_parser-4.0.1/lib/
@ -62,18 +63,17 @@ package_config:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlan
path:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/path-1.8.1/lib/
path_drawing:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/path_drawing-1.0.1/lib/
path_parsing:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/path_parsing-1.0.1/lib/
pedantic:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pedantic-1.11.1/lib/
petitparser:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/petitparser-5.0.0/lib/
photo_view:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/photo_view-0.13.0/lib/
pool:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pool-1.5.1/lib/
provider:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/provider-5.0.0/lib/
pub_semver:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pub_semver-2.1.1/lib/
pubspec_parse:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pubspec_parse-1.2.0/lib/
qr_code_scanner:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/qr_code_scanner-1.0.0/lib/
pubspec_parse:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pubspec_parse-1.2.1/lib/
qr_code_scanner:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/qr_code_scanner-1.0.1/lib/
shelf:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shelf-1.3.2/lib/
shelf_web_socket:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.4+1/lib/
shelf_web_socket:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shelf_web_socket-1.0.2/lib/
sky_engine:file:///C:/Users/thoma/Documents/flutter/bin/cache/pkg/sky_engine/lib/
source_gen:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/source_gen-1.0.5/lib/
source_gen:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/source_gen-1.2.2/lib/
source_span:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/source_span-1.8.2/lib/
sqflite:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/sqflite-2.0.3+1/lib/
sqflite_common:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/sqflite_common-2.2.1+1/lib/
@ -81,11 +81,11 @@ stack_trace:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.o
stream_channel:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/
stream_transform:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/stream_transform-2.0.0/lib/
string_scanner:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/
synchronized:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/synchronized-3.0.0+2/lib/
synchronized:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/synchronized-3.0.0+3/lib/
term_glyph:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/
test_api:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/test_api-0.4.9/lib/
timing:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/timing-1.0.0/lib/
typed_data:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/
typed_data:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.3.1/lib/
vector_math:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.1.2/lib/
watcher:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/watcher-1.0.1/lib/
web_socket_channel:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/web_socket_channel-2.2.0/lib/

3
l10n.yaml Normal file
View File

@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

View File

@ -112,12 +112,12 @@ class _SliderImagesWidget extends State<SliderImagesWidget> {
),
if(widget.resources.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 2.5),
padding: const EdgeInsets.only(bottom: 0),
child: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () {
sliderController!.previousPage(duration: const Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
sliderController!.nextPage(duration: const Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
},
child: Text(
currentIndex.toString()+'/'+widget.resources.length.toString(),

View File

@ -1,5 +1,6 @@
import 'package:manager_api/api.dart';
import 'package:mymuseum_visitapp/app_context.dart';
import 'package:mymuseum_visitapp/translations.dart';
class TranslationHelper {
static String get(List<TranslationDTO>? translationDTO, AppContext appContext) {
@ -9,4 +10,12 @@ class TranslationHelper {
return "";
}
}
static String getFromLocale(String valueToGet, AppContext appContext) {
try {
return translations.where((element) => element.language == appContext.getContext().language).first.data![valueToGet]!;
} catch (_) {
return "";
}
}
}

View File

@ -0,0 +1,8 @@
import 'package:manager_api/api.dart';
class Translation {
String? language = "";
Map<String, String>? data;
Translation({this.language, this.data});
}

View File

@ -228,15 +228,10 @@ class _ArticlePageState extends State<ArticlePage> {
});
}
if(articleDTO!.images!.isNotEmpty) {
print(articleDTO!.images!.length);
print("LOADING IMAGES !!!");
for (var image in articleDTO!.images!) {
await DatabaseHelper.instance.queryWithId(DatabaseTableType.resources, image.resourceId!).then((value) {
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(value.first));
});
print("LOADING DONEOJNEONEONONDONEONE !!!");
}
/*if(mainResource == null && resourcesModel.isNotEmpty) {

View File

@ -10,6 +10,7 @@ import 'package:mymuseum_visitapp/Components/Loading.dart';
import 'package:mymuseum_visitapp/Components/ScannerBouton.dart';
import 'package:mymuseum_visitapp/Helpers/DatabaseHelper.dart';
import 'package:mymuseum_visitapp/Helpers/networkCheck.dart';
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
import 'package:mymuseum_visitapp/Models/resourceModel.dart';
import 'package:mymuseum_visitapp/Models/visitContext.dart';
import 'package:mymuseum_visitapp/Screens/Visit/visit.dart';
@ -17,6 +18,7 @@ import 'package:mymuseum_visitapp/app_context.dart';
import 'package:mymuseum_visitapp/client.dart';
import 'package:mymuseum_visitapp/constants.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@ -33,9 +35,10 @@ class _HomePageState extends State<HomePage> {
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
VisitAppContext visitAppContext = appContext.getContext();
return Scaffold(
appBar: CustomAppBar(
title: "Liste des visites", // Todo translate
title: TranslationHelper.getFromLocale("visitTitle", appContext),
isHomeButton: false,
),
body: SingleChildScrollView(
@ -59,17 +62,21 @@ class _HomePageState extends State<HomePage> {
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
setState(() {
//print(configurations[index].label);
// Update context
VisitAppContext visitAppContext = appContext.getContext();
visitAppContext.configuration = configurations[index];
appContext.setContext(visitAppContext);
if(configurations[index].isOffline! && alreadyDownloaded.any((c) => c == configurations[index].id)) {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => VisitPage(configurationId: configurations[index].id!),
));
});
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(TranslationHelper.getFromLocale("visitDownloadWarning", appContext)), backgroundColor: kBlue2),
);
}
},
child: Container(
height: size.height*0.15,
@ -88,6 +95,7 @@ class _HomePageState extends State<HomePage> {
),
),
),
if(configurations[index].isOffline!)
Positioned(
bottom: 0,
right: 0,
@ -109,6 +117,7 @@ class _HomePageState extends State<HomePage> {
),
)
)
],
),
),
@ -118,7 +127,7 @@ class _HomePageState extends State<HomePage> {
),
);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
return Text(TranslationHelper.getFromLocale("noData", appContext));
} else {
return Center(
child: Container(

View File

@ -81,10 +81,11 @@ class _BodyState extends State<Body> {
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Padding(
padding: const EdgeInsets.only(top: 0),
padding: const EdgeInsets.only(bottom: 0),
child: ListView.builder(
itemCount: sectionsToDisplay.length,
itemBuilder: (context, index) => SectionCard(
itemCount: sectionsToDisplay.length,
itemIndex: index,
sectionDTO: sectionsToDisplay[index],
press: () {
@ -101,7 +102,7 @@ class _BodyState extends State<Body> {
),
);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
return Text(TranslationHelper.getFromLocale("noData", appContext));
} else {
return Center(
child: Container(

View File

@ -14,11 +14,13 @@ class SectionCard extends StatelessWidget {
const SectionCard({
Key? key,
required this.itemIndex,
required this.itemCount,
required this.sectionDTO,
required this.press,
}) : super(key: key);
final int itemIndex;
final int itemCount;
final SectionDTO sectionDTO;
final void Function()? press;
@ -36,9 +38,9 @@ class SectionCard extends StatelessWidget {
}
return Container(
margin: const EdgeInsets.symmetric(
margin: EdgeInsets.symmetric(
horizontal: kDefaultPadding,
vertical: 0,
vertical: sectionDTO.order!+1 == itemCount ? kDefaultPadding : 0,
),
height: 160,
decoration: const BoxDecoration(
@ -93,7 +95,7 @@ class SectionCard extends StatelessWidget {
),
) : const Text("");
} else if (snapshot.connectionState == ConnectionState.none) {
return const Text("No data");
return Text(TranslationHelper.getFromLocale("noData", appContext));
} else {
return Center(
child: SizedBox(

View File

@ -1,81 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/Screens/Visit/product.dart';
import 'package:mymuseum_visitapp/constants.dart';
import 'chat_and_add_to_cart.dart';
import 'list_of_colors.dart';
import 'product_image.dart';
class Body extends StatelessWidget {
final Product product;
const Body({Key? key, required this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
// it provide us total height and width
Size size = MediaQuery.of(context).size;
// it enable scrolling on small devices
return SafeArea(
bottom: false,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: kDefaultPadding),
decoration: BoxDecoration(
color: kBackgroundColor,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(50),
bottomRight: Radius.circular(50),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Center(
child: Hero(
tag: '${product.id}',
child: ProductPoster(
size: size,
image: product.image!,
),
),
),
ListOfColors(),
Padding(
padding: const EdgeInsets.symmetric(
vertical: kDefaultPadding / 2),
child: Text(
product.title!,
style: Theme.of(context).textTheme.headline6,
),
),
Text(
'\$${product.price}',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: kSecondRed,
),
),
Padding(
padding:
EdgeInsets.symmetric(vertical: kDefaultPadding / 2),
child: Text(
product.description!,
style: TextStyle(color: kTextRed),
),
),
SizedBox(height: kDefaultPadding),
],
),
),
ChatAndAddToCart(),
],
),
),
);
}
}

View File

@ -1,51 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:mymuseum_visitapp/constants.dart';
class ChatAndAddToCart extends StatelessWidget {
const ChatAndAddToCart({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(kDefaultPadding),
padding: EdgeInsets.symmetric(
horizontal: kDefaultPadding,
vertical: kDefaultPadding / 2,
),
decoration: BoxDecoration(
color: Color(0xFFFCBF1E),
borderRadius: BorderRadius.circular(30),
),
child: Row(
children: <Widget>[
SvgPicture.asset(
"assets/icons/chat.svg",
height: 18,
),
SizedBox(width: kDefaultPadding / 2),
Text(
"Chat",
style: TextStyle(color: Colors.white),
),
// it will cover all available spaces
Spacer(),
FlatButton.icon(
onPressed: () {},
icon: SvgPicture.asset(
"assets/icons/shopping-bag.svg",
height: 18,
),
label: Text(
"Add to Cart",
style: TextStyle(color: Colors.white),
),
),
],
),
);
}
}

View File

@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/constants.dart';
class ColorDot extends StatelessWidget {
const ColorDot({
Key? key,
required this.fillColor,
// by default we set it false
this.isSelected = false,
}) : super(key: key);
final Color fillColor;
final bool isSelected;
@override
Widget build(BuildContext context) {
return Container(
margin:
// left and right padding 8
EdgeInsets.symmetric(horizontal: kDefaultPadding / 2.5),
padding: EdgeInsets.all(3),
height: 24,
width: 24,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: isSelected ? Color(0xFF707070) : Colors.transparent,
),
),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: fillColor,
),
),
);
}
}

View File

@ -1,32 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/constants.dart';
import 'color_dots.dart';
class ListOfColors extends StatelessWidget {
const ListOfColors({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: kDefaultPadding),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColorDot(
fillColor: Color(0xFF80989A),
isSelected: true,
),
ColorDot(
fillColor: Color(0xFFFF5200),
),
ColorDot(
fillColor: kTestSecondColor,
),
],
),
);
}
}

View File

@ -1,42 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/constants.dart';
class ProductPoster extends StatelessWidget {
const ProductPoster({
Key? key,
required this.size,
required this.image,
}) : super(key: key);
final Size size;
final String image;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(vertical: kDefaultPadding),
// the height of this container is 80% of our width
height: size.width * 0.8,
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
Container(
height: size.width * 0.7,
width: size.width * 0.7,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
Image.asset(
image,
height: size.width * 0.75,
width: size.width * 0.75,
fit: BoxFit.cover,
),
],
),
);
}
}

View File

@ -1,47 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:mymuseum_visitapp/Screens/Visit/product.dart';
import 'package:mymuseum_visitapp/constants.dart';
import 'components/body.dart';
class DetailsScreen extends StatelessWidget {
final Product product;
const DetailsScreen({Key? key, required this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: kTestSecondColor,
appBar: buildAppBar(context),
body: Body(
product: product,
),
);
}
AppBar buildAppBar(BuildContext context) {
return AppBar(
backgroundColor: kBackgroundColor,
elevation: 0,
leading: IconButton(
padding: EdgeInsets.only(left: kDefaultPadding),
icon: SvgPicture.asset("assets/icons/back.svg"),
onPressed: () {
Navigator.pop(context);
},
),
centerTitle: false,
title: Text(
'Back'.toUpperCase(),
style: Theme.of(context).textTheme.bodyText2,
),
actions: <Widget>[
IconButton(
icon: SvgPicture.asset('assets/icons/cart_with_item.svg'),
onPressed: () {},
),
],
);
}
}

View File

@ -1,35 +0,0 @@
class Product {
final int? id, price;
final String? title, description, image;
Product({this.id, this.price, this.title, this.description, this.image});
}
// list of products
// for our demo
List<Product> products = [
Product(
id: 1,
price: 56,
title: "Classic Leather Arm Chair",
image: "assets/images/Item_1.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
Product(
id: 4,
price: 68,
title: "Poppy Plastic Tub Chair",
image: "assets/images/Item_2.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
Product(
id: 9,
price: 39,
title: "Bar Stool Chair",
image: "assets/images/Item_3.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
];

4
lib/l10n/app_en.arb Normal file
View File

@ -0,0 +1,4 @@
{
"visitTitle": "List of tours",
"visitDownloadWarning": "To follow this tour, you must first download it"
}

4
lib/l10n/app_fr.arb Normal file
View File

@ -0,0 +1,4 @@
{
"visitTitle": "Liste des visites",
"visitDownloadWarning": "Pour suivre cette visite, il faut d'abord la télécharger"
}

View File

@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/Screens/Article/article.dart';
import 'package:mymuseum_visitapp/Screens/Home/home.dart';
import 'package:provider/provider.dart';
import 'Helpers/DatabaseHelper.dart';
import 'Models/visitContext.dart';
import 'Screens/Scanner/scanner_old.dart';
import 'app_context.dart';
import 'constants.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -52,10 +51,16 @@ class _MyAppState extends State<MyApp> {
debugShowCheckedModeBanner: false,
title: 'MyVisit App Demo',
initialRoute: widget.initialRoute,
/*supportedLocales: [
const Locale('en', 'US'),
//const Locale('fr', 'FR'),
],*/
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
const Locale('en', ''),
const Locale('fr', ''),
],
theme: ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: kBackgroundColor,

24
lib/translations.dart Normal file
View File

@ -0,0 +1,24 @@
import 'Models/translation.dart';
List<Translation> translations = [
Translation(language: "FR", data: {
"visitTitle": "Liste des visites",
"visitDownloadWarning": "Pour suivre cette visite, il faut d'abord la télécharger",
"noData": "Pas de données"
}),
Translation(language: "EN", data: {
"visitTitle": "List of tours",
"visitDownloadWarning": "To follow this tour, you must first download it",
"noData": "No data"
}),
Translation(language: "DE", data: {
"visitTitle": "Liste der Touren",
"visitDownloadWarning": "Um dieser Tour zu folgen, müssen Sie sie zuerst herunterladen",
"noData": "keine Daten"
}),
Translation(language: "NL", data: {
"visitTitle": "Lijst met rondleidingen",
"visitDownloadWarning": "Om deze tour te volgen, moet je deze eerst downloaden",
"noData": "Geen gegevens"
}),
];

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "31.0.0"
version: "47.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.0"
version: "4.7.0"
args:
dependency: transitive
description:
@ -49,42 +49,42 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.3.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.7"
version: "1.1.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
version: "3.1.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.0.9"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "1.12.2"
version: "2.2.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.12"
version: "7.2.3"
built_collection:
dependency: transitive
description:
@ -98,7 +98,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.4.0"
version: "8.4.1"
carousel_slider:
dependency: "direct main"
description:
@ -127,13 +127,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
clock:
dependency: transitive
description:
@ -147,7 +140,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
version: "4.2.0"
collection:
dependency: transitive
description:
@ -182,7 +175,7 @@ packages:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "2.2.3"
fake_async:
dependency: transitive
description:
@ -196,7 +189,7 @@ packages:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
version: "6.1.4"
fixnum:
dependency: transitive
description:
@ -216,13 +209,18 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.1.5"
flutter_test:
dependency: "direct dev"
description: flutter
@ -233,6 +231,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
glob:
dependency: transitive
description:
@ -246,7 +251,7 @@ packages:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "2.1.0"
http:
dependency: transitive
description:
@ -269,7 +274,7 @@ packages:
source: hosted
version: "4.0.1"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
@ -401,13 +406,6 @@ packages:
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.11.1"
petitparser:
dependency: transitive
description:
@ -449,14 +447,14 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
qr_code_scanner:
dependency: "direct main"
description:
name: qr_code_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
shelf:
dependency: transitive
description:
@ -470,7 +468,7 @@ packages:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
version: "1.0.2"
sky_engine:
dependency: transitive
description: flutter
@ -482,7 +480,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.2.2"
source_span:
dependency: transitive
description:
@ -538,7 +536,7 @@ packages:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+2"
version: "3.0.0+3"
term_glyph:
dependency: transitive
description:
@ -566,7 +564,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
vector_math:
dependency: transitive
description:

View File

@ -29,6 +29,8 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
qr_code_scanner: ^1.0.0
auto_size_text: ^3.0.0
openapi_generator_cli: ^4.0.0
@ -39,6 +41,7 @@ dependencies:
carousel_slider: ^4.0.0
flutter_svg: ^1.1.3
photo_view: ^0.13.0
intl: ^0.17.0
manager_api:
path: manager_api
@ -68,6 +71,7 @@ flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
generate: true
uses-material-design: true
assets: