|
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_loading_manager.dart';
|
|
|
|
|
import 'package:test_sa/providers/loading_list_notifier.dart';
|
|
|
|
|
@ -172,28 +173,34 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
|
|
|
|
|
Flexible(
|
|
|
|
|
child: Text(widget.title, style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: AppColor.floatingTextStyleColor(context))),
|
|
|
|
|
),
|
|
|
|
|
4.height,
|
|
|
|
|
if (_selectedItem.isEmpty)
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.select,
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
padding: const EdgeInsets.only(top: 8),
|
|
|
|
|
separatorBuilder: (cxt, index) => const Divider(
|
|
|
|
|
thickness: 1,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
itemBuilder: (cxt, index) => Text(
|
|
|
|
|
_selectedItem[index].name ?? "", // Null-aware operator for value.name
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
itemCount: _selectedItem.length,
|
|
|
|
|
),
|
|
|
|
|
Wrap(
|
|
|
|
|
runSpacing: 4.toScreenHeight,
|
|
|
|
|
spacing: 4.toScreenWidth,
|
|
|
|
|
children: [
|
|
|
|
|
for (int i = 0; i < _selectedItem.length; i++)
|
|
|
|
|
Chip(
|
|
|
|
|
backgroundColor: AppColor.backgroundTabBarColor(context),
|
|
|
|
|
side: BorderSide(color: AppColor.border2Color(context)),
|
|
|
|
|
label: Text(_selectedItem[i].name!),
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
labelStyle: AppTextStyles.tinyFont2.copyWith(color: AppColor.labelTextStyleColor(context)),
|
|
|
|
|
deleteIconColor: AppColor.icon2Color(context),
|
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onDeleted: () {
|
|
|
|
|
_selectedItem.removeAt(i);
|
|
|
|
|
setState(() {});
|
|
|
|
|
widget.onSelect!(_selectedItem);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 4),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
.onPress(
|
|
|
|
|
@ -204,7 +211,7 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
|
|
|
|
|
: null,
|
|
|
|
|
)
|
|
|
|
|
.expanded,
|
|
|
|
|
if (widget.enabled) const Icon(Icons.keyboard_arrow_down_rounded),
|
|
|
|
|
if (widget.enabled) const Icon(Icons.keyboard_arrow_down_rounded).paddingOnly(top: 4),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|