Fix issue landscape mode
This commit is contained in:
parent
2b04324ba4
commit
f63bd05cc8
@ -62,177 +62,179 @@ class _QuestionsListWidget extends State<QuestionsListWidget> {
|
|||||||
//color: Colors.orange,
|
//color: Colors.orange,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
SingleChildScrollView(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
if(_questionsSubDTO.isNotEmpty)
|
children: [
|
||||||
CarouselSlider(
|
if(_questionsSubDTO.isNotEmpty)
|
||||||
carouselController: sliderController,
|
CarouselSlider(
|
||||||
options: CarouselOptions(
|
carouselController: sliderController,
|
||||||
onPageChanged: (int index, CarouselPageChangedReason reason) {
|
options: CarouselOptions(
|
||||||
setState(() {
|
onPageChanged: (int index, CarouselPageChangedReason reason) {
|
||||||
currentIndex = index + 1;
|
setState(() {
|
||||||
});
|
currentIndex = index + 1;
|
||||||
},
|
});
|
||||||
height: widget.isShowResponse ? widget.orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.79 : MediaQuery.of(context).size.height * 0.6 : MediaQuery.of(context).size.height * 0.85,
|
},
|
||||||
enlargeCenterPage: true,
|
height: widget.isShowResponse ? widget.orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.79 : MediaQuery.of(context).size.height * 0.6 : MediaQuery.of(context).size.height * 0.85,
|
||||||
scrollPhysics: const NeverScrollableScrollPhysics(),
|
enlargeCenterPage: true,
|
||||||
reverse: false,
|
scrollPhysics: const NeverScrollableScrollPhysics(),
|
||||||
),
|
reverse: false,
|
||||||
items: _questionsSubDTO.map<Widget>((i) {
|
),
|
||||||
return Builder(
|
items: _questionsSubDTO.map<Widget>((i) {
|
||||||
builder: (BuildContext context) {
|
return Builder(
|
||||||
return Padding(
|
builder: (BuildContext context) {
|
||||||
padding: const EdgeInsets.only(left: 7.5, right: 7.5, bottom: 10.0, top: 8.0),
|
return Padding(
|
||||||
child: Container(
|
padding: const EdgeInsets.only(left: 7.5, right: 7.5, bottom: 10.0, top: 8.0),
|
||||||
width: MediaQuery.of(context).size.width,
|
child: Container(
|
||||||
// height: widget.isShowResponse ? MediaQuery.of(context).size.height *0.55 : MediaQuery.of(context).size.height,
|
width: MediaQuery.of(context).size.width,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 1.5),
|
// height: widget.isShowResponse ? MediaQuery.of(context).size.height *0.55 : MediaQuery.of(context).size.height,
|
||||||
decoration: BoxDecoration(
|
margin: const EdgeInsets.symmetric(horizontal: 1.5),
|
||||||
//color: Colors.orange, //kBackgroundLight
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.rectangle,
|
//color: Colors.orange, //kBackgroundLight
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
shape: BoxShape.rectangle,
|
||||||
image: i.source_ != null ? DecorationImage(
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
fit: BoxFit.cover,
|
image: i.source_ != null ? DecorationImage(
|
||||||
opacity: 0.35,
|
fit: BoxFit.cover,
|
||||||
image: NetworkImage(
|
opacity: 0.35,
|
||||||
i.source_!,
|
image: NetworkImage(
|
||||||
),
|
i.source_!,
|
||||||
): null,
|
|
||||||
boxShadow: const [
|
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.5,
|
|
||||||
blurRadius: 5,
|
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
//crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
//color: Colors.red,
|
|
||||||
//width: MediaQuery.of(context).size.width *0.65,
|
|
||||||
height: MediaQuery.of(context).size.height *0.25,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Center(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: kBackgroundLight, //kBackgroundLight
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
boxShadow: const [
|
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.3,
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: Offset(0, 2), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
width: MediaQuery.of(context).size.width *0.7,
|
|
||||||
height: MediaQuery.of(context).size.height *0.2,
|
|
||||||
child: Center(
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(2.5),
|
|
||||||
child: Text(TranslationHelper.get(i.label, appContext.getContext() as VisitAppContext), textAlign: TextAlign.center, style: const TextStyle(fontSize: kDescriptionSize)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
),
|
): null,
|
||||||
/*SizedBox(
|
boxShadow: const [
|
||||||
height: MediaQuery.of(context).size.height * 0.01,
|
BoxShadow(
|
||||||
),*/
|
color: kBackgroundSecondGrey,
|
||||||
Expanded(
|
spreadRadius: 0.5,
|
||||||
child: Padding(
|
blurRadius: 5,
|
||||||
padding: const EdgeInsets.all(5.0),
|
offset: Offset(0, 1.5), // changes position of shadow
|
||||||
child: SizedBox(
|
),
|
||||||
//height: MediaQuery.of(context).size.height * 0.75,
|
],
|
||||||
width: MediaQuery.of(context).size.width * 0.72,
|
),
|
||||||
//color: Colors.green,
|
child: Column(
|
||||||
child: Padding(
|
//crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
padding: const EdgeInsets.all(10.0),
|
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
child: GridView.builder(
|
children: [
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
SizedBox(
|
||||||
crossAxisCount: widget.orientation == Orientation.portrait ? 1 : 2, // TODO HERE IS TABLET
|
//color: Colors.red,
|
||||||
mainAxisExtent: widget.isShowResponse ?
|
//width: MediaQuery.of(context).size.width *0.65,
|
||||||
widget.orientation == Orientation.portrait ?
|
height: MediaQuery.of(context).size.height *0.25,
|
||||||
60 :
|
child: Stack(
|
||||||
50 :
|
children: [
|
||||||
widget.orientation == Orientation.portrait ?
|
Center(
|
||||||
60 :
|
child: Container(
|
||||||
60, // TODO depends on percentage
|
decoration: BoxDecoration(
|
||||||
mainAxisSpacing: widget.isShowResponse ?
|
color: kBackgroundLight, //kBackgroundLight
|
||||||
widget.orientation == Orientation.portrait ?
|
shape: BoxShape.rectangle,
|
||||||
30 :
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
10 :
|
boxShadow: const [
|
||||||
widget.orientation == Orientation.portrait ?
|
BoxShadow(
|
||||||
32.5 :
|
color: kBackgroundSecondGrey,
|
||||||
32.5, // TODO depends on percentage
|
spreadRadius: 0.3,
|
||||||
crossAxisSpacing: widget.isShowResponse ? 0 : 0, // TODO depends on percentage
|
blurRadius: 4,
|
||||||
),
|
offset: Offset(0, 2), // changes position of shadow
|
||||||
itemCount: i.responsesSubDTO!.length,
|
),
|
||||||
itemBuilder: (BuildContext ctx, index) {
|
],
|
||||||
return InkWell(
|
),
|
||||||
onTap: () {
|
width: MediaQuery.of(context).size.width *0.7,
|
||||||
if(!widget.isShowResponse) {
|
height: MediaQuery.of(context).size.height *0.2,
|
||||||
setState(() {
|
child: Center(
|
||||||
i.chosen = index;
|
child: SingleChildScrollView(
|
||||||
if(currentIndex == _questionsSubDTO.length && i.chosen == index)
|
child: Padding(
|
||||||
{
|
padding: const EdgeInsets.all(2.5),
|
||||||
widget.onShowResponse();
|
child: Text(TranslationHelper.get(i.label, appContext.getContext() as VisitAppContext), textAlign: TextAlign.center, style: const TextStyle(fontSize: kDescriptionSize)),
|
||||||
//showResult = true;
|
|
||||||
//_controllerCenter!.play(); // TODO Maybe show only confetti on super score ..
|
|
||||||
} else {
|
|
||||||
sliderController!.nextPage(duration: const Duration(milliseconds: 650), curve: Curves.fastOutSlowIn);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(2.5),
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(TranslationHelper.get(i.responsesSubDTO![index].label, appContext.getContext() as VisitAppContext), textAlign: TextAlign.center, style: TextStyle(fontSize: kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black)),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: !widget.isShowResponse ? i.chosen == index ? kTestSecondColor : kBackgroundLight : i.responsesSubDTO![index].isGood! ? kGreen : i.chosen == index ? kTextRed : kBackgroundLight,
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
boxShadow: const [
|
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.3,
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: Offset(0, 2), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
}),
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
/*SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.01,
|
||||||
|
),*/
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(5.0),
|
||||||
|
child: SizedBox(
|
||||||
|
//height: MediaQuery.of(context).size.height * 0.75,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.72,
|
||||||
|
//color: Colors.green,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: widget.orientation == Orientation.portrait ? 1 : 2, // TODO HERE IS TABLET
|
||||||
|
mainAxisExtent: widget.isShowResponse ?
|
||||||
|
widget.orientation == Orientation.portrait ?
|
||||||
|
60 :
|
||||||
|
50 :
|
||||||
|
widget.orientation == Orientation.portrait ?
|
||||||
|
60 :
|
||||||
|
60, // TODO depends on percentage
|
||||||
|
mainAxisSpacing: widget.isShowResponse ?
|
||||||
|
widget.orientation == Orientation.portrait ?
|
||||||
|
30 :
|
||||||
|
10 :
|
||||||
|
widget.orientation == Orientation.portrait ?
|
||||||
|
32.5 :
|
||||||
|
32.5, // TODO depends on percentage
|
||||||
|
crossAxisSpacing: widget.isShowResponse ? 0 : 0, // TODO depends on percentage
|
||||||
|
),
|
||||||
|
itemCount: i.responsesSubDTO!.length,
|
||||||
|
itemBuilder: (BuildContext ctx, index) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if(!widget.isShowResponse) {
|
||||||
|
setState(() {
|
||||||
|
i.chosen = index;
|
||||||
|
if(currentIndex == _questionsSubDTO.length && i.chosen == index)
|
||||||
|
{
|
||||||
|
widget.onShowResponse();
|
||||||
|
//showResult = true;
|
||||||
|
//_controllerCenter!.play(); // TODO Maybe show only confetti on super score ..
|
||||||
|
} else {
|
||||||
|
sliderController!.nextPage(duration: const Duration(milliseconds: 650), curve: Curves.fastOutSlowIn);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(2.5),
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(TranslationHelper.get(i.responsesSubDTO![index].label, appContext.getContext() as VisitAppContext), textAlign: TextAlign.center, style: TextStyle(fontSize: kDescriptionSize, color: i.chosen == index ? Colors.white : Colors.black)),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: !widget.isShowResponse ? i.chosen == index ? kTestSecondColor : kBackgroundLight : i.responsesSubDTO![index].isGood! ? kGreen : i.chosen == index ? kTextRed : kBackgroundLight,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: kBackgroundSecondGrey,
|
||||||
|
spreadRadius: 0.3,
|
||||||
|
blurRadius: 4,
|
||||||
|
offset: Offset(0, 2), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
)
|
||||||
)
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
if(widget.questionsSubDTO!.isNotEmpty && _questionsSubDTO.length > 1 && currentIndex != _questionsSubDTO.length && _questionsSubDTO[currentIndex-1].chosen != null)
|
if(widget.questionsSubDTO!.isNotEmpty && _questionsSubDTO.length > 1 && currentIndex != _questionsSubDTO.length && _questionsSubDTO[currentIndex-1].chosen != null)
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user