Fix layout issue + languages filter (according to config but neet refresh of get config (via mqtt))

This commit is contained in:
Thomas Fransolet 2021-07-17 17:38:37 +02:00
parent 63d435ea0e
commit e16a298cec
2 changed files with 77 additions and 73 deletions

View File

@ -13,6 +13,7 @@ class LanguageSelection extends StatefulWidget {
}
class _LanguageSelection extends State<LanguageSelection> with TickerProviderStateMixin {
List<String> languagesEnable;
Size sizeScreen = new Size(1080.0, 1920.0); // Tablet resolution
double flagSize = 60;
@ -54,6 +55,7 @@ class _LanguageSelection extends State<LanguageSelection> with TickerProviderSta
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
selectedLanguage = (appContext.getContext() as TabletAppContext).language;
languagesEnable = (appContext.getContext() as TabletAppContext).configuration.languages;
return Stack(
children: [
@ -86,7 +88,7 @@ class _LanguageSelection extends State<LanguageSelection> with TickerProviderSta
ListView(
children: [
if(minimized) ... [
for(var language in languages.where((element) => element.toUpperCase() != selectedLanguage ))
for(var language in languagesEnable.where((element) => element.toUpperCase() != selectedLanguage ))
InkWell(
onTap: () {
setState(() {

View File

@ -69,83 +69,85 @@ class _MainViewWidget extends State<MainViewWidget> {
break;
}
return Scaffold(
body: Column(
children: [
Container(
width: size.width,
height: size.height * 0.12,
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 15.0, top: 10.0),
child: AspectRatio(
aspectRatio: 4 / 4,
child: Container(
/*width: 125,
height: 125,*/
decoration: boxDecoration(sectionSelected),
body: SingleChildScrollView(
child: Column(
children: [
Container(
width: size.width,
height: size.height * 0.12,
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 15.0, top: 10.0),
child: AspectRatio(
aspectRatio: 4 / 4,
child: Container(
/*width: 125,
height: 125,*/
decoration: boxDecoration(sectionSelected),
),
),
),
),
SizedBox(
width: 25,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
sectionSelected.title.firstWhere((translation) => translation.language == appContext.getContext().language).value,
style: new TextStyle(fontSize: 25),
maxLines: 1,
),
)
),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
sectionSelected.description.firstWhere((translation) => translation.language == appContext.getContext().language).value,
style: new TextStyle(fontSize: 20),
maxLines: 2,
),
)
)
],
),
)
],
),
),
Padding(
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 15.0),
child: Container(
width: size.width,
height: size.height * 0.85,
decoration: sectionSelected.type != SectionType.video && sectionSelected.type != SectionType.web ? BoxDecoration(
color: kBackgroundLight,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0),
boxShadow: [
BoxShadow(
color: kBackgroundSecondGrey,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
SizedBox(
width: 25,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
sectionSelected.title.firstWhere((translation) => translation.language == appContext.getContext().language).value,
style: new TextStyle(fontSize: 25),
maxLines: 1,
),
)
),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: AutoSizeText(
sectionSelected.description.firstWhere((translation) => translation.language == appContext.getContext().language).value,
style: new TextStyle(fontSize: 20),
maxLines: 2,
),
)
)
],
),
)
],
) : null,
child: Padding(
padding: const EdgeInsets.all(0.0),
child: elementToShow),
),
),
)
],
Padding(
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 15.0),
child: Container(
width: size.width,
height: size.height * 0.85,
decoration: sectionSelected.type != SectionType.video && sectionSelected.type != SectionType.web ? BoxDecoration(
color: kBackgroundLight,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0),
boxShadow: [
BoxShadow(
color: kBackgroundSecondGrey,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
) : null,
child: Padding(
padding: const EdgeInsets.all(0.0),
child: elementToShow),
),
)
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Container(