Refactor loading animation in LoadingComponent to use SingleChildScrollView for better layout handling
This commit is contained in:
parent
fb2823c340
commit
eeddee5168
@ -78,28 +78,30 @@ class _LoadingAnimation extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
Images.loadingLogo,
|
||||
height: imageSize,
|
||||
width: imageSize,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
loadingText,
|
||||
style: _textStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (showDots)
|
||||
LoadingAnimationWidget.waveDots(
|
||||
color: const Color(0xFFEF0000),
|
||||
size: 50,
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
Images.loadingLogo,
|
||||
height: imageSize,
|
||||
width: imageSize,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
loadingText,
|
||||
style: _textStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (showDots)
|
||||
LoadingAnimationWidget.waveDots(
|
||||
color: const Color(0xFFEF0000),
|
||||
size: 50,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -72,64 +72,68 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
width: 1.5,
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
width: 1.5,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: PopupMenuButton<String>(
|
||||
onSelected: (String value) async {
|
||||
if (value.isEmpty) {
|
||||
employeesScreenController.selectedProjectId =
|
||||
null;
|
||||
await employeesScreenController
|
||||
.fetchAllEmployees();
|
||||
} else {
|
||||
employeesScreenController.selectedProjectId =
|
||||
value;
|
||||
await employeesScreenController
|
||||
.fetchEmployeesByProject(value);
|
||||
}
|
||||
employeesScreenController.update();
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
List<PopupMenuItem<String>> items = [
|
||||
PopupMenuItem<String>(
|
||||
value: '',
|
||||
child: MyText.bodySmall('All Employees',
|
||||
fontWeight: 600),
|
||||
child: PopupMenuButton<String>(
|
||||
onSelected: (String value) async {
|
||||
if (value.isEmpty) {
|
||||
employeesScreenController.selectedProjectId =
|
||||
null;
|
||||
await employeesScreenController
|
||||
.fetchAllEmployees();
|
||||
} else {
|
||||
employeesScreenController.selectedProjectId =
|
||||
value;
|
||||
await employeesScreenController
|
||||
.fetchEmployeesByProject(value);
|
||||
}
|
||||
employeesScreenController.update();
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
List<PopupMenuItem<String>> items = [
|
||||
PopupMenuItem<String>(
|
||||
value: '',
|
||||
child: MyText.bodySmall('All Employees',
|
||||
fontWeight: 600),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(
|
||||
employeesScreenController.projects
|
||||
.map<PopupMenuItem<String>>((project) {
|
||||
return PopupMenuItem<String>(
|
||||
value: project.id,
|
||||
child: MyText.bodySmall(project.name),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
return items;
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0, vertical: 8.0),
|
||||
child: Text(
|
||||
employeesScreenController.selectedProjectId ==
|
||||
null
|
||||
? 'All Employees'
|
||||
: employeesScreenController.projects
|
||||
.firstWhere((project) =>
|
||||
project.id ==
|
||||
employeesScreenController
|
||||
.selectedProjectId)
|
||||
.name,
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(
|
||||
employeesScreenController.projects
|
||||
.map<PopupMenuItem<String>>((project) {
|
||||
return PopupMenuItem<String>(
|
||||
value: project.id,
|
||||
child: MyText.bodySmall(project.name),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
return items;
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0, vertical: 8.0),
|
||||
child: MyText.bodySmall(
|
||||
employeesScreenController.selectedProjectId ==
|
||||
null
|
||||
? 'All Employees'
|
||||
: employeesScreenController.projects
|
||||
.firstWhere((project) =>
|
||||
project.id ==
|
||||
employeesScreenController
|
||||
.selectedProjectId)
|
||||
.name,
|
||||
fontWeight: 600,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user