- 新增 DetailItemScreen 组件,用于展示物品详细信息 - 在 ItemListScreen 中添加物品列表项的点击事件,跳转到物品详情页面- 修改 Item 模型,将 isInUse 字段类型从 String改为 String? - 更新数据库表结构,将 is_in_use 列类型从 INTEGER 改为 TEXT
27 lines
654 B
Dart
27 lines
654 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:item_tracker/models/item_model.dart';
|
|
|
|
class DetailItemScreen extends StatelessWidget {
|
|
final Item item;
|
|
|
|
DetailItemScreen({required this.item});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('${item.name}'),
|
|
),
|
|
body: Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('名称: ${item.toMap().toString()}'),
|
|
Text('描述: ${item.description}')
|
|
]
|
|
)
|
|
)
|
|
);
|
|
}
|
|
} |