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:get/get.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/Screens/Home/home.dart';
|
||||
import 'package:mymuseum_visitapp/app_context.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
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 bool isHomeButton;
|
||||
bool? isTextSizeButton = false;
|
||||
final double _preferredHeight = 50;
|
||||
|
||||
@override
|
||||
@ -25,17 +24,17 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
VisitAppContext visitAppContext = appContext.getContext();
|
||||
|
||||
final notchInset = MediaQuery.of(context).padding;
|
||||
return AppBar(
|
||||
title: Text(widget.title),
|
||||
centerTitle: true,
|
||||
leading: widget.isHomeButton ? IconButton(
|
||||
icon: Icon(Icons.home),
|
||||
icon: const Icon(Icons.home),
|
||||
onPressed: () {
|
||||
// Set new State
|
||||
setState(() {
|
||||
VisitAppContext visitAppContext = appContext.getContext();
|
||||
visitAppContext.configuration = null;
|
||||
visitAppContext.isScanningBeacons = false;
|
||||
//Navigator.of(context).pop();
|
||||
@ -45,9 +44,22 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
});
|
||||
}
|
||||
) : null,
|
||||
actions: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
actions: [
|
||||
if(widget.isTextSizeButton != null && widget.isTextSizeButton!)
|
||||
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(
|
||||
width: 50,
|
||||
height: 50,
|
||||
|
||||
@ -16,6 +16,7 @@ class VisitAppContext with ChangeNotifier{
|
||||
bool isContentCurrentlyShown = false;
|
||||
bool isScanningBeacons = false;
|
||||
bool isScanBeaconAlreadyAllowed = false;
|
||||
bool isMaximizeTextSize = false;
|
||||
|
||||
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
||||
appBar: CustomAppBar(
|
||||
title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, visitAppContext!) : "",
|
||||
isHomeButton: false,
|
||||
isTextSizeButton: true,
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: getArticle(appContext, appContext.clientAPI, widget.articleId),
|
||||
@ -199,7 +200,7 @@ class _ArticlePageState extends State<ArticlePage> {
|
||||
child: Text(
|
||||
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||
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(
|
||||
TranslationHelper.get(articleDTO!.content, appContext.getContext()),
|
||||
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 kArticleDescriptionSize = 12.5;
|
||||
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 String defaultLanguage = "EN";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user