|
@@ -0,0 +1,89 @@
|
|
|
+import 'package:fis_ui/index.dart';
|
|
|
+import 'package:fis_ui/base_define/page.dart';
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+
|
|
|
+///搜索组件
|
|
|
+class FSearchInput extends FStatefulWidget {
|
|
|
+ FSearchInput({
|
|
|
+ Key? key,
|
|
|
+ this.onChanged,
|
|
|
+ this.serchOnPressed,
|
|
|
+ this.hintText,
|
|
|
+ this.controller,
|
|
|
+ required this.businessParent,
|
|
|
+ }) : super(key: key);
|
|
|
+
|
|
|
+ ///父级节点
|
|
|
+ final FPage businessParent;
|
|
|
+
|
|
|
+ ///查询文本编辑Controller
|
|
|
+ final TextEditingController? controller;
|
|
|
+
|
|
|
+ ///查找事件回调
|
|
|
+ final VoidCallback? serchOnPressed;
|
|
|
+
|
|
|
+ ///文本改变回调
|
|
|
+ final ValueChanged? onChanged;
|
|
|
+
|
|
|
+ ///提示文字
|
|
|
+ final String? hintText;
|
|
|
+
|
|
|
+ @override
|
|
|
+ FState<FSearchInput> createState() => _FSearchInputState();
|
|
|
+}
|
|
|
+
|
|
|
+class _FSearchInputState extends FState<FSearchInput> {
|
|
|
+ @override
|
|
|
+ FWidget build(BuildContext context) {
|
|
|
+ return FContainer(
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
|
+ color: Colors.white,
|
|
|
+ child: FRow(
|
|
|
+ children: [
|
|
|
+ FExpanded(
|
|
|
+ child: _buildSearchInput(),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ FWidget _buildSearchInput() {
|
|
|
+ return FContainer(
|
|
|
+ height: 36,
|
|
|
+ child: FRow(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ FBorderInput(
|
|
|
+ hintSize: 16,
|
|
|
+ contentSize: 16,
|
|
|
+ controller: widget.controller ?? TextEditingController(),
|
|
|
+ borderColor: Color.fromRGBO(211, 211, 211, 1),
|
|
|
+ suffixIcon: FMaterial(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: FIconButton(
|
|
|
+ name: "search",
|
|
|
+ businessParent: widget.businessParent,
|
|
|
+ onPressed: () {
|
|
|
+ widget.serchOnPressed!.call();
|
|
|
+ },
|
|
|
+ icon: FIcon(
|
|
|
+ Icons.search,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ height: 36,
|
|
|
+ hintText: widget.hintText,
|
|
|
+ onChanged: (value) {
|
|
|
+ widget.onChanged!.call(value);
|
|
|
+ },
|
|
|
+ textInputAction: TextInputAction.search,
|
|
|
+ onSubmitted: (value) {
|
|
|
+ widget.serchOnPressed!.call();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|