From 31e9aa917fa529ae4582375c1c6fe53bbdba5b74 Mon Sep 17 00:00:00 2001 From: Dynesshely Date: Tue, 8 Oct 2024 14:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=BE=20Feat:=20Basic=20Plugins=20Page?= =?UTF-8?q?=20Framework?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/pages/controls/plugin_card.dart | 20 ++++++ .../lib/pages/controls/plugin_item.dart | 26 +++++++ .../kitx_website/lib/pages/plugins_page.dart | 69 ++++++++++++++++++- .../kitx_website/lib/shared/plugin_info.dart | 28 ++++++++ .../lib/utils/translation/en_us.dart | 1 + .../lib/utils/translation/zh_cn.dart | 1 + .../kitx_website/pubspec.yaml | 2 +- 7 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 KitX Website Flutter/kitx_website/lib/pages/controls/plugin_card.dart create mode 100644 KitX Website Flutter/kitx_website/lib/pages/controls/plugin_item.dart create mode 100644 KitX Website Flutter/kitx_website/lib/shared/plugin_info.dart diff --git a/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_card.dart b/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_card.dart new file mode 100644 index 0000000..4c52fb6 --- /dev/null +++ b/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_card.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:kitx_website/shared/plugin_info.dart'; + +class PluginCard extends StatelessWidget { + const PluginCard({ + required this.info, + }); + + final PluginInfo info; + + @override + Widget build(BuildContext context) { + return Card.filled( + child: const SizedBox( + width: 200, + height: 300, + ), + ); + } +} diff --git a/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_item.dart b/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_item.dart new file mode 100644 index 0000000..20c6b9d --- /dev/null +++ b/KitX Website Flutter/kitx_website/lib/pages/controls/plugin_item.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:kitx_website/pages/controls/plugin_card.dart'; +import 'package:kitx_website/shared/plugin_info.dart'; + +class PluginItem extends StatelessWidget { + const PluginItem({ + required this.info, + }); + + final PluginInfo info; + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + return size.width > size.height + ? PluginCard(info: info) + : Padding( + padding: EdgeInsets.all(5), + child: ListTile( + title: Text(info.name), + subtitle: Text(info.author), + onTap: () {}, + ), + ); + } +} diff --git a/KitX Website Flutter/kitx_website/lib/pages/plugins_page.dart b/KitX Website Flutter/kitx_website/lib/pages/plugins_page.dart index 45a769d..10108fa 100644 --- a/KitX Website Flutter/kitx_website/lib/pages/plugins_page.dart +++ b/KitX Website Flutter/kitx_website/lib/pages/plugins_page.dart @@ -1,4 +1,8 @@ +import 'package:community_material_icon/community_material_icon.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:kitx_website/pages/controls/plugin_item.dart'; +import 'package:kitx_website/shared/plugin_info.dart'; class PluginsPage extends StatefulWidget { const PluginsPage({super.key}); @@ -15,6 +19,69 @@ class _PluginsPageState extends State { @override Widget build(BuildContext context) { - return Center(child: Text('Under developing ...')); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 15, + ), + child: Row( + children: [ + const Icon( + CommunityMaterialIcons.cube_outline, + size: 32, + ), + Text( + ' ${'Plugins_Title'.tr}', + style: const TextStyle(fontSize: 32), + ), + ], + ), + ), + const SizedBox(height: 10), + Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 20, right: 15), + child: SizedBox( + width: MediaQuery.of(context).size.width > 600 ? 400 : MediaQuery.of(context).size.width - 38.5, + child: TextField( + autofocus: true, + decoration: InputDecoration( + prefixIcon: const Icon(Icons.search), + border: OutlineInputBorder(), + labelText: 'Search plugins ...', + ), + ), + ), + ), + ], + ), + const SizedBox(height: 10), + Padding( + padding: EdgeInsets.all(15), + child: Wrap( + spacing: 10, + runSpacing: 10, + children: [ + PluginItem( + info: PluginInfo( + name: 'Test Plugin', + version: 'v0.0.1', + author: 'Eaucooh', + authorLink: null, + publisher: 'Crequency', + publisherLink: null, + iconBase64: null, + lastUpdated: DateTime.now(), + ), + ) + ], + ), + ) + ], + ); } } diff --git a/KitX Website Flutter/kitx_website/lib/shared/plugin_info.dart b/KitX Website Flutter/kitx_website/lib/shared/plugin_info.dart new file mode 100644 index 0000000..122bbac --- /dev/null +++ b/KitX Website Flutter/kitx_website/lib/shared/plugin_info.dart @@ -0,0 +1,28 @@ +class PluginInfo { + const PluginInfo({ + required this.name, + required this.version, + required this.author, + required this.authorLink, + required this.publisher, + required this.publisherLink, + required this.iconBase64, + required this.lastUpdated, + }); + + final String name; + + final String version; + + final String author; + + final String? authorLink; + + final String publisher; + + final String? publisherLink; + + final String? iconBase64; + + final DateTime lastUpdated; +} diff --git a/KitX Website Flutter/kitx_website/lib/utils/translation/en_us.dart b/KitX Website Flutter/kitx_website/lib/utils/translation/en_us.dart index 7635ef7..34469cf 100644 --- a/KitX Website Flutter/kitx_website/lib/utils/translation/en_us.dart +++ b/KitX Website Flutter/kitx_website/lib/utils/translation/en_us.dart @@ -31,4 +31,5 @@ const Map en_US = { 'MultiArchSupport': 'Support multi architectures', 'Get-on-F-Droid': 'Get on F-Droid', 'Get-on-F-Droid-Details': 'You can get this on F-Droid and keep updating', + 'Plugins_Title': 'Download Plugins', }; diff --git a/KitX Website Flutter/kitx_website/lib/utils/translation/zh_cn.dart b/KitX Website Flutter/kitx_website/lib/utils/translation/zh_cn.dart index 555feb6..b227475 100644 --- a/KitX Website Flutter/kitx_website/lib/utils/translation/zh_cn.dart +++ b/KitX Website Flutter/kitx_website/lib/utils/translation/zh_cn.dart @@ -31,4 +31,5 @@ const Map zh_CN = { 'MultiArchSupport': '包含多个架构支持', 'Get-on-F-Droid': '在 F-Droid 上获取', 'Get-on-F-Droid-Details': '您可以在 F-Droid 上获取并保持最新', + 'Plugins_Title': '下载插件', }; diff --git a/KitX Website Flutter/kitx_website/pubspec.yaml b/KitX Website Flutter/kitx_website/pubspec.yaml index 4756a42..70c96ec 100644 --- a/KitX Website Flutter/kitx_website/pubspec.yaml +++ b/KitX Website Flutter/kitx_website/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: dev_dependencies: build: ^2.4.1 build_runner: ^2.4.12 - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter_test: sdk: flutter flutter_web_optimizer: ^1.4.1