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

View File

@ -69,83 +69,85 @@ class _MainViewWidget extends State<MainViewWidget> {
break; break;
} }
return Scaffold( return Scaffold(
body: Column( body: SingleChildScrollView(
children: [ child: Column(
Container( children: [
width: size.width, Container(
height: size.height * 0.12, width: size.width,
child: Row( height: size.height * 0.12,
children: [ child: Row(
Padding( children: [
padding: const EdgeInsets.only(left: 15.0, top: 10.0), Padding(
child: AspectRatio( padding: const EdgeInsets.only(left: 15.0, top: 10.0),
aspectRatio: 4 / 4, child: AspectRatio(
child: Container( aspectRatio: 4 / 4,
/*width: 125, child: Container(
height: 125,*/ /*width: 125,
decoration: boxDecoration(sectionSelected), height: 125,*/
decoration: boxDecoration(sectionSelected),
),
), ),
), ),
), SizedBox(
SizedBox( width: 25,
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
), ),
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, floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Container( floatingActionButton: Container(