mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 03:43:41 +00:00
feat: ui improvement
flutter 3.7 compatibility responsive view beautiful progress bar select file in treeview downlading and downloaded page
This commit is contained in:
1 parent
a875a9258e
commit
9b1ed15fea
28 files changed
+932
-439
No files matched your search
@@ -0,0 +1,182 @@
|
||||
findIcon(String ext) {
|
||||
String res = 'document';
|
||||
for (var iconMap in iconMaps) {
|
||||
if (iconMap['extensions'].contains(ext)) {
|
||||
res = iconMap['thumbnail'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const List iconMaps = [
|
||||
//media
|
||||
{
|
||||
'extensions': ['jpg', 'png', 'gif', 'bmp', 'jpeg', 'jpe', 'jif', 'jfif', 'jfi', 'webp', 'tiff', 'tif', 'ico', 'svg', 'webp'],
|
||||
'type': 'Image',
|
||||
'thumbnail': 'file_image'
|
||||
},
|
||||
{
|
||||
'extensions': ['mp4', 'webm', 'mpg', 'mp2', 'mpeg', 'mpe', 'mpv', 'ocg', 'm4p', 'm4v', 'avi', 'wmv', 'mov', 'qt', 'flv', 'swf', 'mkv', 'rmvb', 'rm', 'vob', '3gp'],
|
||||
'type': 'Video',
|
||||
'thumbnail': 'my_movies_t_v'
|
||||
},
|
||||
{
|
||||
'extensions': ['mp3', 'ogg', 'ogm', 'wav', '.aac', '.ape', '.flac', '.flav', '.m4a', '.wma'],
|
||||
'type': 'Audio',
|
||||
'thumbnail': 'music_in_collection_fill'
|
||||
},
|
||||
//compressed
|
||||
{
|
||||
'extensions': ['7z', 'brotli', 'bzip2', 'gz', 'gzip', 'rar', 'tgz', 'xz', 'zip', 'zstd', 'deb', 'msi', 'snap', 'iso', 'dmg', 'dockerfile', 'dockerignore'],
|
||||
'type': 'Archive',
|
||||
'thumbnail': 'package'
|
||||
},
|
||||
//office relative
|
||||
{
|
||||
'extensions': ['pdf'],
|
||||
'type': 'Portable Document Format',
|
||||
'thumbnail': 'pdf'
|
||||
},
|
||||
{
|
||||
'extensions': ['txt', 'doc', 'docb', 'docm', 'dot', 'dotm', 'docx', 'rtf'],
|
||||
'type': 'Word Document',
|
||||
'thumbnail': 'text_document_edit'
|
||||
},
|
||||
{
|
||||
'extensions': ['xlsx', 'xls', 'xlsb', 'xls', 'ods', 'fods', 'csv'],
|
||||
'type': 'Excel Document',
|
||||
'thumbnail': 'excel_document'
|
||||
},
|
||||
{
|
||||
'extensions': ['pot', 'potm', 'potx', 'ppam', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptn', 'pptx'],
|
||||
'type': 'Powerpoint Document',
|
||||
'thumbnail': 'power_point_document'
|
||||
},
|
||||
//other
|
||||
{
|
||||
'extensions': ['lnk'],
|
||||
'type': 'Shortcut',
|
||||
'thumbnail': 'file_symlink'
|
||||
},
|
||||
{
|
||||
'extensions': ['ini', 'dlc', 'config', 'conf', 'properties', 'prop', 'settings', 'option', 'props', 'toml', 'prefs', 'sln.dotsettings', 'sln.dotsettings.user', 'cfg'],
|
||||
'type': 'Settings',
|
||||
'thumbnail': 'text_document_settings'
|
||||
},
|
||||
{
|
||||
'extensions': ['html', 'htm', 'xhtml', 'html_vm'],
|
||||
'type': 'html',
|
||||
'thumbnail': 'file_h_t_m_l'
|
||||
},
|
||||
//code relative
|
||||
// {
|
||||
// 'extensions': ['sh', 'bat'],
|
||||
// 'type': 'Batch',
|
||||
// 'thumbnail': 'power_shell'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': [
|
||||
// 'js',
|
||||
// 'jsx',
|
||||
// 'json',
|
||||
// 'tsbuildinfo',
|
||||
// 'json5',
|
||||
// 'jsonl',
|
||||
// 'ndjson'
|
||||
// ],
|
||||
// 'type': 'JavaScript',
|
||||
// 'thumbnail': 'js'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': ['ts', 'tsx'],
|
||||
// 'type': 'TypeScript',
|
||||
// 'thumbnail': 'type_script_language'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// 'extensions': ['asp', 'aspx', 'php', 'jsp'],
|
||||
// 'type': 'HyperText Markup Language',
|
||||
// 'thumbnail': 'file_a_s_p_x'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': [
|
||||
// 'accdb',
|
||||
// 'db',
|
||||
// 'db3',
|
||||
// 'mdb',
|
||||
// 'pdb',
|
||||
// 'pgsql',
|
||||
// 'pkb',
|
||||
// 'pks',
|
||||
// 'postgres',
|
||||
// 'psql',
|
||||
// 'sql',
|
||||
// 'sqlite',
|
||||
// 'sqlite3'
|
||||
// ],
|
||||
// 'type': 'Database',
|
||||
// 'thumbnail': 'database'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// 'extensions': ['exe'],
|
||||
// 'type': 'Executable',
|
||||
// 'thumbnail': 'product'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': [
|
||||
// 'c',
|
||||
// 'h',
|
||||
// 'cc',
|
||||
// 'cpp',
|
||||
// 'cxx',
|
||||
// 'c++',
|
||||
// 'cp',
|
||||
// 'mm',
|
||||
// 'mii',
|
||||
// 'ii',
|
||||
// 'dart',
|
||||
// 'go'
|
||||
// ],
|
||||
// 'type': 'other Program language',
|
||||
// 'thumbnail': 'file_code'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': ['py', 'py3', 'pyc', 'pylintrc', 'python-version'],
|
||||
// 'type': 'Python Program',
|
||||
// 'thumbnail': 'py'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': ['md', 'markdown', 'rst'],
|
||||
// 'type': 'Markdown',
|
||||
// 'thumbnail': 'mark_down_language'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': ['yml', 'yaml'],
|
||||
// 'type': 'Yet Anoter Markup Language',
|
||||
// 'thumbnail': 'file_y_m_l'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// 'type': 'Visual Studio',
|
||||
// 'extensions': [
|
||||
// 'csproj',
|
||||
// 'ruleset',
|
||||
// 'sln',
|
||||
// 'suo',
|
||||
// 'vb',
|
||||
// 'vbs',
|
||||
// 'vcxitems',
|
||||
// 'vcxitems.filters',
|
||||
// 'vcxproj',
|
||||
// 'vcxproj.filters'
|
||||
// ],
|
||||
// 'thumbnail': 'visual_studio_for_windows'
|
||||
// },
|
||||
// {
|
||||
// 'extensions': ['java'],
|
||||
// 'type': 'Java Program',
|
||||
// 'thumbnail': 'file_j_a_v_a'
|
||||
// },
|
||||
];
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ResponsiveBuilder extends StatelessWidget {
|
||||
const ResponsiveBuilder({
|
||||
required this.narrowBuilder,
|
||||
required this.mediumBuilder,
|
||||
required this.wideBuilder,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget Function(
|
||||
BuildContext context,
|
||||
BoxConstraints constraints,
|
||||
) narrowBuilder;
|
||||
|
||||
final Widget Function(
|
||||
BuildContext context,
|
||||
BoxConstraints constraints,
|
||||
) mediumBuilder;
|
||||
|
||||
final Widget Function(
|
||||
BuildContext context,
|
||||
BoxConstraints constraints,
|
||||
) wideBuilder;
|
||||
|
||||
static bool isNarrow(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width < 768;
|
||||
|
||||
static bool isMedium(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width < 992 &&
|
||||
MediaQuery.of(context).size.width >= 768;
|
||||
|
||||
static bool isWide(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width >= 992;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (constraints.maxWidth >= 992) {
|
||||
return wideBuilder(context, constraints);
|
||||
} else if (constraints.maxWidth >= 768) {
|
||||
return mediumBuilder(context, constraints);
|
||||
} else {
|
||||
return narrowBuilder(context, constraints);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user