Until three days ago everything was working fine. I tried following the guidelines and similar questions, but did not solve.
Can you help me please?
Below I paste the error and the code
The error:
The relevant error-causing widget was:
Column Column:file:///C:/Sviluppo/Chores/lib/app/modules/settings/views/settings_view.dart:20:16
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
The specific RenderFlex in question is: RenderFlex#63d42 OVERFLOWING
… parentData: offset=Offset(20.6, 56.6) (can use size)
… constraints: BoxConstraints(w=390.9, h=650.8)
… size: Size(390.9, 650.8)
… direction: vertical
… mainAxisAlignment: start
… mainAxisSize: max
… crossAxisAlignment: start
… textDirection: ltr
… verticalDirection: down
This is the code
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:chores/app/modules/settings/controllers/settings_controller.dart';
import 'package:chores/app/theme/text_theme.dart';
class SettingsView extends GetView<SettingsController> {
@override
Widget build(BuildContext context) {
Size size = Get.size;
return Scaffold(
body: Container(
height: size.height,
width: size.width,
padding:
EdgeInsets.only(top: size.height * 0.08, left: size.width * 0.05),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Imposta',
style: kSubHeadTextStyle.copyWith(fontWeight: FontWeight.bold),
),
SizedBox(
height: size.height * 0.07,
),
ListTile(
contentPadding:
EdgeInsets.symmetric(horizontal: size.width * 0.04),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Aspetto',
style: kSub2HeadTextStyle.copyWith(
color: Theme.of(context).primaryColorDark,
),
),
GetBuilder<SettingsController>(
init: SettingsController(),
builder: (controller) {
return DropdownButton(
value: controller.selectedTheme,
underline: Container(color: Colors.transparent),
hint: Text('Seleziona'),
items: controller.themes.map(
(String? value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value!),
);
},
).toList(),
onChanged: controller.changeTheme,
dropdownColor: Theme.of(context).primaryColorLight,
);
},
)
],
),
leading: Icon(
FontAwesomeIcons.palette,
color: Theme.of(context).primaryColor,
size: size.width * 0.06,
),
),
ListTile(
title: Text(
'Promemoria quotidiano',
style: kSub2HeadTextStyle.copyWith(
color: Theme.of(context).primaryColorDark,
fontSize: 17,
),
),
trailing: GetBuilder<SettingsController>(
init: controller,
builder: (_) {
return Switch(
value: controller.drinkWater!,
onChanged: controller.toggleWater,
activeTrackColor:
Theme.of(context).primaryColor.withOpacity(0.5),
activeColor: Theme.of(context).primaryColor,
);
},
),
leading: Icon(
Icons.opacity,
color: Theme.of(context).primaryColor,
size: size.width * 0.07,
),
),
],
),
),
);
}
}
2
Answers
I think you are facing this error because of the dropdown list you are passing, first, check that the selected value is not null.
Also, make sure that all the dropdown values are different.
You can try to wrap your code with scrollable widget. For example widget SingleChildScrollView or use ListView
SingleChildScrollView(
child: new Column(
children: [
Text..
]
)
)