parent
6b9aa04ccc
commit
b19314c6c7
|
|
@ -80,7 +80,7 @@ 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}'
|
||||||
// key: Key('category_${category.id}'),
|
// key: Key('category_${category.id}'),
|
||||||
//onPress: () => () {},
|
//onPress: () => () {},
|
||||||
);
|
);
|
||||||
|
|
@ -113,7 +113,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()..name = 'Корневая категория';
|
||||||
});
|
});
|
||||||
String parentName = category.name;
|
String parentName = category.name;
|
||||||
final CategoryRowDao rowDao =
|
final CategoryRowDao rowDao =
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:satu/shared/app_colors.dart';
|
import 'package:satu/shared/app_colors.dart';
|
||||||
|
|
||||||
class DictionaryTile extends StatelessWidget {
|
class DictionaryTile extends StatelessWidget {
|
||||||
const DictionaryTile(
|
const DictionaryTile({required this.title, this.subTitle, Key? key})
|
||||||
{
|
|
||||||
required this.title,
|
|
||||||
this.subTitle,
|
|
||||||
Key? key
|
|
||||||
})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
@ -16,16 +11,20 @@ class DictionaryTile extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(color: whiteColor),
|
||||||
color: whiteColor
|
|
||||||
),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.symmetric( horizontal: 15.0 , vertical: 10.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(title),
|
Text(
|
||||||
if(subTitle != null)
|
title,
|
||||||
Text(subTitle!),
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
if (subTitle != null && subTitle!.isNotEmpty)
|
||||||
|
Text(subTitle!,
|
||||||
|
style:
|
||||||
|
const TextStyle(fontSize: 10, color: placeholderColor)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue