- category_view.dart

- dictionary_list_tile.dart
null-safety-migration
suvaissov 2021-08-06 17:00:32 +06:00
parent 6b9aa04ccc
commit b19314c6c7
2 changed files with 14 additions and 15 deletions

View File

@ -80,7 +80,7 @@ class _CategoryDictionaryViewState extends State<CategoryDictionaryView> {
itemBuilder: (BuildContext context, int index) {
final CategoryRowDao category = items[index];
return DictionaryTile(
title: category.name, subTitle: category.parentName
title: category.name, subTitle: 'Родитель: ${category.parentName}'
// key: Key('category_${category.id}'),
//onPress: () => () {},
);
@ -113,7 +113,7 @@ class _CategoryDictionaryViewState extends State<CategoryDictionaryView> {
filtered.forEach((element) {
final Category category = _categories
.firstWhere((parent) => parent.id == element.parentId, orElse: () {
return Category()..name = '';
return Category()..name = 'Корневая категория';
});
String parentName = category.name;
final CategoryRowDao rowDao =

View File

@ -2,12 +2,7 @@ import 'package:flutter/material.dart';
import 'package:satu/shared/app_colors.dart';
class DictionaryTile extends StatelessWidget {
const DictionaryTile(
{
required this.title,
this.subTitle,
Key? key
})
const DictionaryTile({required this.title, this.subTitle, Key? key})
: super(key: key);
final String title;
@ -16,16 +11,20 @@ class DictionaryTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
color: whiteColor
),
decoration: const BoxDecoration(color: whiteColor),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.symmetric( horizontal: 15.0 , vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title),
if(subTitle != null)
Text(subTitle!),
Text(
title,
style: const TextStyle(fontSize: 12),
),
if (subTitle != null && subTitle!.isNotEmpty)
Text(subTitle!,
style:
const TextStyle(fontSize: 10, color: placeholderColor)),
],
),
),