mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 10:57:54 +00:00
Extracted menu sections and buttons into separate data structures for better organization and readability in the menu view. Updated MenuList widget to dynamically render buttons based on the new data structure.
48 lines
1.6 KiB
Dart
48 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_app/features/menu/model/menu_list_model.dart';
|
|
import 'package:syncrow_app/features/menu/view/widgets/menu_list_divider.dart';
|
|
import 'package:syncrow_app/features/menu/view/widgets/menu_list_item.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
|
|
class MenuList extends StatelessWidget {
|
|
const MenuList({
|
|
super.key,
|
|
required this.section,
|
|
});
|
|
|
|
final Map<String, dynamic> section;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const SizedBox(height: 5),
|
|
BodySmall(
|
|
text: section['title'] as String,
|
|
),
|
|
const SizedBox(height: 5),
|
|
DefaultContainer(
|
|
child: ListView.separated(
|
|
shrinkWrap: true,
|
|
padding: const EdgeInsets.all(0),
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: section['buttons'].length,
|
|
itemBuilder: (context, index) {
|
|
return MenuListItem(
|
|
title: section['buttons'][index]['title'] as String,
|
|
icon: section['buttons'][index]['Icon'] as String,
|
|
page: section['buttons'][index]['page'] as Widget?,
|
|
color: section['color'],
|
|
);
|
|
},
|
|
separatorBuilder: (context, index) => const MenuListDivider()),
|
|
),
|
|
const SizedBox(height: 5),
|
|
],
|
|
);
|
|
}
|
|
}
|