Add update size text for article
This commit is contained in:
parent
d2e76a37fd
commit
cb80c35856
@ -1,17 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:mymuseum_visitapp/Components/LanguageSelection.dart';
|
import 'package:mymuseum_visitapp/Components/LanguageSelection.dart';
|
||||||
import 'package:mymuseum_visitapp/Helpers/requirement_state_controller.dart';
|
|
||||||
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
import 'package:mymuseum_visitapp/Screens/Home/home.dart';
|
import 'package:mymuseum_visitapp/Screens/Home/home.dart';
|
||||||
import 'package:mymuseum_visitapp/app_context.dart';
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
||||||
CustomAppBar({Key? key, required this.title, required this.isHomeButton});
|
CustomAppBar({Key? key, required this.title, required this.isHomeButton, this.isTextSizeButton});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final bool isHomeButton;
|
final bool isHomeButton;
|
||||||
|
bool? isTextSizeButton = false;
|
||||||
final double _preferredHeight = 50;
|
final double _preferredHeight = 50;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -25,17 +24,17 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
@override
|
@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();
|
||||||
|
|
||||||
final notchInset = MediaQuery.of(context).padding;
|
final notchInset = MediaQuery.of(context).padding;
|
||||||
return AppBar(
|
return AppBar(
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
leading: widget.isHomeButton ? IconButton(
|
leading: widget.isHomeButton ? IconButton(
|
||||||
icon: Icon(Icons.home),
|
icon: const Icon(Icons.home),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Set new State
|
// Set new State
|
||||||
setState(() {
|
setState(() {
|
||||||
VisitAppContext visitAppContext = appContext.getContext();
|
|
||||||
visitAppContext.configuration = null;
|
visitAppContext.configuration = null;
|
||||||
visitAppContext.isScanningBeacons = false;
|
visitAppContext.isScanningBeacons = false;
|
||||||
//Navigator.of(context).pop();
|
//Navigator.of(context).pop();
|
||||||
@ -45,9 +44,22 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
) : null,
|
) : null,
|
||||||
actions: const [
|
actions: [
|
||||||
Padding(
|
if(widget.isTextSizeButton != null && widget.isTextSizeButton!)
|
||||||
padding: EdgeInsets.only(right: 10.0),
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
visitAppContext.isMaximizeTextSize = !visitAppContext.isMaximizeTextSize;
|
||||||
|
appContext.setContext(visitAppContext);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: 50,
|
||||||
|
child: visitAppContext.isMaximizeTextSize ? const Icon(Icons.text_fields) : const Icon(Icons.format_size)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(right: 5.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class VisitAppContext with ChangeNotifier{
|
|||||||
bool isContentCurrentlyShown = false;
|
bool isContentCurrentlyShown = false;
|
||||||
bool isScanningBeacons = false;
|
bool isScanningBeacons = false;
|
||||||
bool isScanBeaconAlreadyAllowed = false;
|
bool isScanBeaconAlreadyAllowed = false;
|
||||||
|
bool isMaximizeTextSize = false;
|
||||||
|
|
||||||
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, visitAppContext!) : "",
|
title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, visitAppContext!) : "",
|
||||||
isHomeButton: false,
|
isHomeButton: false,
|
||||||
|
isTextSizeButton: true,
|
||||||
),
|
),
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
future: getArticle(appContext, appContext.clientAPI, widget.articleId),
|
future: getArticle(appContext, appContext.clientAPI, widget.articleId),
|
||||||
@ -199,7 +200,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: const TextStyle(fontSize: kArticleContentSize)
|
style: TextStyle(fontSize: (appContext.getContext() as VisitAppContext).isMaximizeTextSize ? kArticleContentBiggerSize : kArticleContentSize)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -232,7 +233,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: const TextStyle(fontSize: kArticleContentSize)
|
style: TextStyle(fontSize: (appContext.getContext() as VisitAppContext).isMaximizeTextSize ? kArticleContentBiggerSize : kArticleContentSize)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -9,6 +9,7 @@ const kConfigurationColor = Color(0xFF2F4858);
|
|||||||
const kArticleTitleSize = 25.0;
|
const kArticleTitleSize = 25.0;
|
||||||
const kArticleDescriptionSize = 12.5;
|
const kArticleDescriptionSize = 12.5;
|
||||||
const kArticleContentSize = 16.0;
|
const kArticleContentSize = 16.0;
|
||||||
|
const kArticleContentBiggerSize = 24.0;
|
||||||
|
|
||||||
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "PL", "CN", "AR", "UK"]; // hmmmm depends on config..
|
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "PL", "CN", "AR", "UK"]; // hmmmm depends on config..
|
||||||
const String defaultLanguage = "EN";
|
const String defaultLanguage = "EN";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user