- category_edit.dart
parent
b19314c6c7
commit
15e1ffef2e
|
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CategoryEdit extends StatefulWidget {
|
||||||
|
const CategoryEdit({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CategoryEditState createState() => _CategoryEditState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CategoryEditState extends State<CategoryEdit> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -69,10 +69,6 @@ class _CategoryDictionaryViewState extends State<CategoryDictionaryView> {
|
||||||
controller: _searchTextController,
|
controller: _searchTextController,
|
||||||
fieldFocusNode: _searchFocusNode,
|
fieldFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
verticalSpaceTiny,
|
|
||||||
const ProductsTitleBarBar(
|
|
||||||
title: 'Выберите категорию',
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
|
|
@ -80,7 +76,10 @@ class _CategoryDictionaryViewState extends State<CategoryDictionaryView> {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final CategoryRowDao category = items[index];
|
final CategoryRowDao category = items[index];
|
||||||
return DictionaryTile(
|
return DictionaryTile(
|
||||||
title: category.name, subTitle: 'Родитель: ${category.parentName}'
|
title: category.name,
|
||||||
|
subTitle: category.parentName.isEmpty
|
||||||
|
? 'Корневая категория'
|
||||||
|
: 'Родитель: ${category.parentName}'
|
||||||
// key: Key('category_${category.id}'),
|
// key: Key('category_${category.id}'),
|
||||||
//onPress: () => () {},
|
//onPress: () => () {},
|
||||||
);
|
);
|
||||||
|
|
@ -113,7 +112,7 @@ class _CategoryDictionaryViewState extends State<CategoryDictionaryView> {
|
||||||
filtered.forEach((element) {
|
filtered.forEach((element) {
|
||||||
final Category category = _categories
|
final Category category = _categories
|
||||||
.firstWhere((parent) => parent.id == element.parentId, orElse: () {
|
.firstWhere((parent) => parent.id == element.parentId, orElse: () {
|
||||||
return Category()..name = 'Корневая категория';
|
return Category();
|
||||||
});
|
});
|
||||||
String parentName = category.name;
|
String parentName = category.name;
|
||||||
final CategoryRowDao rowDao =
|
final CategoryRowDao rowDao =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue