-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8884af2
Showing
31 changed files
with
1,929 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This is a generated file; do not edit or check into version control. | ||
file_selector_linux=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_linux-0.9.2+1/ | ||
file_selector_macos=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_macos-0.9.4/ | ||
file_selector_windows=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_windows-0.9.3+1/ | ||
flutter_plugin_android_lifecycle=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-2.0.19/ | ||
image_picker=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker-1.1.2/ | ||
image_picker_android=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_android-0.8.12+1/ | ||
image_picker_for_web=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_for_web-3.0.4/ | ||
image_picker_ios=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_ios-0.8.12/ | ||
image_picker_linux=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_linux-0.2.1+1/ | ||
image_picker_macos=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_macos-0.2.1+1/ | ||
image_picker_windows=/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_windows-0.2.1+1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_ios-0.8.12/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-2.0.19/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_android-0.8.12+1/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"file_selector_macos","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_macos-0.9.4/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]}],"linux":[{"name":"file_selector_linux","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]}],"windows":[{"name":"file_selector_windows","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/file_selector_windows-0.9.3+1/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]}],"web":[{"name":"image_picker_for_web","path":"/Users/yogo/.pub-cache/hosted/pub.flutter-io.cn/image_picker_for_web-3.0.4/","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]}],"date_created":"2024-06-20 15:38:37.937571","version":"3.19.6"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d" | ||
channel: "stable" | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add your license here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- | ||
This README describes the package. If you publish this package to pub.dev, | ||
this README's contents appear on the landing page for your package. | ||
For information about how to write a good package README, see the guide for | ||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). | ||
For general information about developing packages, see the Dart guide for | ||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) | ||
and the Flutter guide for | ||
[developing packages and plugins](https://flutter.dev/developing-packages). | ||
--> | ||
|
||
TODO: Put a short description of the package here that helps potential users | ||
know whether this package might be useful for them. | ||
|
||
## Features | ||
|
||
TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
|
||
## Getting started | ||
|
||
TODO: List prerequisites and provide or point to information on how to | ||
start using the package. | ||
|
||
## Usage | ||
|
||
TODO: Include short and useful examples for package users. Add longer examples | ||
to `/example` folder. | ||
|
||
```dart | ||
const like = 'sample'; | ||
``` | ||
|
||
## Additional information | ||
|
||
TODO: Tell users more about the package: where to find more information, how to | ||
contribute to the package, how to file issues, what response they can expect | ||
from the package authors, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# 表单生成 | ||
|
||
## 通用参数 | ||
|
||
除 `group` 外,其他类型都有以下通用参数 | ||
|
||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|----------|-----|---------|-------|------| | ||
| type | 类型 | String | '' | true | | ||
| field | 字段名 | String | '' | true | | ||
| label | 标签 | String | - | - | | ||
| hiddenLabel | 隐藏标签 | bool | false | - | | ||
| value | 默认值 | dynamic | - | - | | ||
| disabled | 是否禁用 | bool | false | - | | ||
| readonly | 是否只读 | bool | false | - | | ||
| rules | 校验规则 | List | [] | - | | ||
|
||
## 表单类型 | ||
|
||
### group 分组 | ||
|
||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|-------------|------|-----------|---------|------| | ||
| type | 类型 | String | 'group' | true | | ||
| field | 字段名 | String | '' | - | | ||
| label | 标签 | String | '' | - | | ||
| hiddenLabel | 隐藏标签 | bool | '' | - | | ||
| children | 子表单 | List<Map> | [] | - | | ||
|
||
### text 文本框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|------|----|--------|--------|------| | ||
| type | 类型 | String | 'text' | true | | ||
| placeholder | 提示 | String | - | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### password 密码框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|------|----|--------|--------|------| | ||
| type | 类型 | String | 'password' | true | | ||
| placeholder | 提示 | String | - | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### textArea 多行文本框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|------|----|--------|--------|------| | ||
| type | 类型 | String | 'textArea' | true | | ||
| placeholder | 提示 | String | - | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### number 数字 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|------|----|--------|--------|------| | ||
| type | 类型 | String | 'number' | true | | ||
| placeholder | 提示 | String | - | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### radio 单选框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'radio' | true | | ||
| options | 选项 | List<Map> | [] | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### checkbox 复选框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'checkbox' | true | | ||
| options | 选项 | List<Map> | [] | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### select 下拉框 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'select' | true | | ||
| options | 选项 | List<Map> | [] | - | | ||
| multiple | 是否多选 | bool | false | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### switch 开关 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'switch' | true | | ||
| 通用参数 | - | - | - | - | | ||
|
||
### media 多媒体上传 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'media' | true | | ||
| multiple | 是否多选 | bool | false | - | | ||
| 通用参数 | - | - | - | - | | ||
|
||
#### ios配置 info.plist | ||
``` | ||
<key>NSCameraUsageDescription</key> | ||
<string>需要摄像头拍照或扫码</string> | ||
<key>NSPhotoLibraryUsageDescription</key> | ||
<string>需要从图库选择照片或视频</string> | ||
<key>NSMicrophoneUsageDescription</key> | ||
<string>录制视频需要访问麦克风</string> | ||
``` | ||
|
||
#### android配置 AndroidManifest.xml | ||
``` | ||
<uses-permission android:name="android.permission.CAMERA" /> | ||
``` | ||
|
||
### date 日期选择 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'date' | true | | ||
| | | | | | | ||
|
||
|
||
### time 时间选择 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'time' | true | | ||
| | | | | | | ||
|
||
### datetime 日期时间选择 | ||
| 字段 | 描述 | 类型 | 默认值 | 必填 | | ||
|---------|----|-----------|---------|------| | ||
| type | 类型 | String | 'datetime' | true | | ||
| | | | | | | ||
|
||
## 验证规则 | ||
- required 必填 | ||
- type 快捷校验类型 | ||
- email 邮箱 | ||
- url 网址 | ||
- min string 类型时为字符串长度;number 类型时为确定数字; array 类型时为数组长度 | ||
- max string 类型时为字符串长度;number 类型时为确定数字; array 类型时为数组长度 | ||
- len string 类型时为字符串长度;number 类型时为确定数字; array 类型时为数组长度 | ||
- pattern 正则校验 | ||
- message 错误提示信息 | ||
|
||
## 依赖项 | ||
- image_picker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
double groupSpace = 10; | ||
double fieldSpace = 10; | ||
|
||
TextStyle groupLabelStyle = const TextStyle( | ||
height: 1.5, | ||
fontSize: 14, | ||
color: Colors.white, | ||
); | ||
TextStyle labelStyle = const TextStyle( | ||
height: 1.5, | ||
fontSize: 12, | ||
color: Colors.white, | ||
); | ||
TextStyle fieldStyle = const TextStyle( | ||
height: 1.2, | ||
fontSize: 10, | ||
color: Colors.white, | ||
); | ||
TextStyle hintStyle = fieldStyle.copyWith(color: Colors.grey); | ||
TextStyle errorStyle = const TextStyle( | ||
height: 1.3, | ||
fontSize: 12, | ||
color: Color(0xffffb4ab), | ||
); | ||
|
||
Color primaryColor = Colors.blue; | ||
Color errorColor = Colors.red; | ||
Color disabledColor = Colors.grey; | ||
|
||
InputDecoration inputDecoration(String? placeholder) { | ||
final border = OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(8), | ||
borderSide: const BorderSide( | ||
color: Colors.transparent, | ||
width: 1, | ||
), | ||
); | ||
|
||
return InputDecoration( | ||
// 减少垂直空间布局 | ||
isDense: true, | ||
// 背景色灰色 | ||
filled: true, | ||
fillColor: const Color(0xff0F1719).withOpacity(0.5), | ||
// labelText: '姓名', | ||
// 占位符,提示文案 | ||
hintText: placeholder, | ||
hintStyle: hintStyle, | ||
// prefix: Text('* 姓名:'), | ||
// prefixIcon: const Icon(Icons.person), | ||
// 边框 | ||
border: border, | ||
enabledBorder: border, | ||
disabledBorder: border, | ||
focusedBorder: border.copyWith( | ||
borderSide: BorderSide(color: primaryColor), | ||
), | ||
errorBorder: border.copyWith( | ||
borderSide: BorderSide(color: errorColor), | ||
), | ||
); | ||
} |
Oops, something went wrong.