form_floating_action_button
peiffer-innovations/form_floating_action_button open-source repository details.
- 星標
- 3
- 分支
- 0
- 最近推送(UTC)
- 2026年2月16日
- 專案狀態
- 已封存
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
Table of Contents
form_floating_action_button
A plugin to add some basic form functionality to the Floating Action Button.
Demo
Installation
Add to pubspec.yaml
dependencies:
...
form_floating_action_button: any
Usage Example
Import form_floating_action_button.dart
import 'package:form_floating_action_button/form_floating_action_button.dart';
Usage within a Form
Widget build(BuildContext context) {
return Form(
child: Scaffold(
appBar: AppBar(
title: Text('Form Validate'),
),
body: Material(
child: ListView(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: TextFormField(
decoration: InputDecoration(
labelText: 'Email',
),
onFieldSubmitted: (_) {
_controller.firePressed();
},
validator: (value) {
String error;
if (value?.isNotEmpty != true) {
error = 'Email is required';
} else if (value.contains('@') != true ||
value.contains('.') != true) {
error = 'Email is not valid';
}
return error;
},
),
),
],
),
),
floatingActionButton: FormFloatingActionButton(
controller: _controller,
loading: _loading,
onSubmit: () {
setState(() => _loading = true);
Future.delayed(Duration(seconds: 5)).then((_) {
if (mounted) {
setState(() {
_loading = false;
});
}
});
},
),
),
);
}
Custom On Validate
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('On Validate'),
),
body: Material(
child: ListView(
children: <Widget>[
ListTile(
onTap: () {
setState(() => _validateSuccess = !_validateSuccess);
},
title: Text('Validation Successful'),
trailing: IgnorePointer(
child: Switch(
value: _validateSuccess,
onChanged: (_) {},
),
),
)
],
),
),
floatingActionButton: FormFloatingActionButton(
loading: _loading,
onSubmit: () {
setState(() => _loading = true);
Future.delayed(Duration(seconds: 5)).then((_) {
if (mounted) {
setState(() {
_loading = false;
});
}
});
},
onValidate: () {
return Future.value(_validateSuccess);
},
),
);
}
語言DartHTMLSwiftObjective-CKotlin
使用的依賴
依賴清單 4 項
- flutter
{"sdk":"flutter"} - vector_math
^2.1.4 - flutter_lints開發依賴
^5.0.0 - flutter_test開發依賴
{"sdk":"flutter"}
如何選擇適合專案的儲存庫?
先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
- 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
- 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
- 使用前在 GitHub 確認 README、授權條款與 Issues。
來源與維護
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗
