55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// 元件库页面
|
|
class ComponentLibraryScreen extends StatelessWidget {
|
|
const ComponentLibraryScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('元件库'),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.search),
|
|
onPressed: () {
|
|
// TODO: 搜索元件
|
|
},
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.add),
|
|
onPressed: () {
|
|
// TODO: 添加自定义元件
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: ListView.builder(
|
|
itemCount: _mockComponents.length,
|
|
itemBuilder: (context, index) {
|
|
final component = _mockComponents[index];
|
|
return ListTile(
|
|
leading: const Icon(Icons.memory),
|
|
title: Text(component['name']!),
|
|
subtitle: Text(component['footprint']!),
|
|
trailing: Text(component['category']!),
|
|
onTap: () {
|
|
// TODO: 选择元件
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// 模拟元件数据
|
|
final List<Map<String, String>> _mockComponents = [
|
|
{'name': 'Resistor', 'footprint': 'R0805', 'category': '被动元件'},
|
|
{'name': 'Capacitor', 'footprint': 'C0603', 'category': '被动元件'},
|
|
{'name': 'LED', 'footprint': 'LED0603', 'category': '光电器件'},
|
|
{'name': 'Transistor', 'footprint': 'SOT23', 'category': '半导体'},
|
|
{'name': 'IC', 'footprint': 'SOIC8', 'category': '集成电路'},
|
|
{'name': 'Connector', 'footprint': 'HDR1X2', 'category': '连接器'},
|
|
];
|