269 lines
11 KiB
Dart
269 lines
11 KiB
Dart
import 'package:ef/ef.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
|
|
|
import '../../common/color/appFontsize.dart';
|
|
import '../../common/util/MyUtils.dart';
|
|
|
|
class SearchWidget extends GetView {
|
|
final String? keyword;
|
|
final Color? color;
|
|
String? hint;
|
|
Function? onChange;
|
|
Function? findCallback;
|
|
|
|
SearchWidget(
|
|
{required this.keyword,
|
|
required this.color,
|
|
this.hint = "请输入关键字",
|
|
this.findCallback,
|
|
this.onChange});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(25, 0, 25, 0),
|
|
child: Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: themeController.currentColor.sc3,
|
|
borderRadius: BorderRadius.circular(20.rpx),
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(35.rpx, 0, 35.rpx, 0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
|
|
child: Container(
|
|
width: 25.rpx,
|
|
height: 25.rpx,
|
|
// width: double.infinity,
|
|
decoration: BoxDecoration(),
|
|
child: SvgPicture.asset(
|
|
'assets/img/icon/query.svg',
|
|
fit: BoxFit.cover,
|
|
color: stringToColor("#333333"), //固定
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
width: 100.rpx,
|
|
height: 80.rpx,
|
|
decoration: BoxDecoration(
|
|
color:
|
|
FlutterFlowTheme.of(context).secondaryBackground,
|
|
),
|
|
child: Align(
|
|
alignment: AlignmentDirectional(-1, 0),
|
|
child: TextFormField(
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 26.rpx,
|
|
letterSpacing: 0.0,
|
|
),
|
|
hintText: hint,
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 26.rpx,
|
|
letterSpacing: 0.0,
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: Color(0x00000000),
|
|
width: 1.rpx,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.rpx),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: Color(0x00000000),
|
|
width: 1.rpx,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.rpx),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 1.rpx,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.rpx),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 1.rpx,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.rpx),
|
|
),
|
|
filled: false,
|
|
fillColor: themeController.currentColor.sc22,
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 26.rpx,
|
|
letterSpacing: 0.0,
|
|
),
|
|
cursorColor:
|
|
FlutterFlowTheme.of(context).primaryText,
|
|
// validator: _model
|
|
// .textControllerValidator
|
|
// .asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
].divide(SizedBox(width: 6.rpx)),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
SizedBox(
|
|
height: 50.rpx,
|
|
child: VerticalDivider(
|
|
thickness: 2.rpx,
|
|
color: stringToColor("#333333"), //固定
|
|
),
|
|
),
|
|
Text(
|
|
'搜索'.tr,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 30.rpx,
|
|
letterSpacing: 0.0,
|
|
color: stringToColor("#333333"), //固定
|
|
),
|
|
),
|
|
].divide(SizedBox(width: 26.rpx)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
// Container(
|
|
// width: MediaQuery.sizeOf(context).width,
|
|
// height: 44,
|
|
// decoration: BoxDecoration(
|
|
// // color: Colors.red,
|
|
// borderRadius: BorderRadius.circular(50.rpx),
|
|
// ),
|
|
// child: Container(
|
|
// width: MediaQuery.sizeOf(context).width,
|
|
// height: 44,
|
|
// decoration: BoxDecoration(
|
|
// color: valueOrDefault<Color>(
|
|
// color,
|
|
// Color(0xFF821111),
|
|
// ),
|
|
// borderRadius: BorderRadius.circular(50),
|
|
// ),
|
|
// child: Stack(
|
|
// children: [
|
|
// Align(
|
|
// alignment: AlignmentDirectional(0, 0),
|
|
// child: Padding(
|
|
// padding: EdgeInsetsDirectional.fromSTEB(0, 6, 0, 6),
|
|
// child: Container(
|
|
// padding: EdgeInsets.only(right: 30.rpx),
|
|
// width: double.infinity,
|
|
// height: 70.rpx,
|
|
// decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(10.rpx)),
|
|
// child: TextField(
|
|
// controller: TextEditingController(text: keyword),
|
|
// onChanged: (d) {
|
|
// onChange?.call(d);
|
|
// },
|
|
// style: TextStyle(
|
|
// fontSize: 28.rpx, color: stringToColor("#C8CBD2")),
|
|
// decoration: InputDecoration(
|
|
// contentPadding:
|
|
// EdgeInsets.only(top: 0, bottom: 0, right: 20.rpx),
|
|
// border: OutlineInputBorder(
|
|
// borderSide: BorderSide.none,
|
|
// borderRadius: BorderRadius.circular(50.rpx)),
|
|
// filled: true,
|
|
// hintText: "$hint",
|
|
// hintStyle: TextStyle(color: stringToColor("#c8cbd2")),
|
|
// fillColor: stringToColor("#FFFFFF"),
|
|
// // prefixIcon: Icon(
|
|
// // Icons.search,
|
|
// // size: 42.rpx,
|
|
// // color: stringToColor("#D3B684"),
|
|
// // ),
|
|
// prefixIcon: Container(
|
|
// padding: EdgeInsets.all(15.rpx), // 可根据需求调整内边距
|
|
// child: SvgPicture.asset(
|
|
// 'assets/images/search.svg',
|
|
// fit: BoxFit.contain, // 确保 SVG 图像不会超出边界
|
|
// color: stringToColor("#D3B684"),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// )),
|
|
// Align(
|
|
// alignment: AlignmentDirectional(0.95, 0),
|
|
// child: Padding(
|
|
// padding: EdgeInsetsDirectional.fromSTEB(0, 5, 0, 5),
|
|
// child: InkWell(
|
|
// onTap: () {
|
|
// findCallback?.call();
|
|
// },
|
|
// child: Container(
|
|
// width: 50,
|
|
// // height: 50,
|
|
// height: MediaQuery.sizeOf(context).height * 1,
|
|
// decoration: BoxDecoration(
|
|
// color: Color(0xFFD3B684),
|
|
// borderRadius: BorderRadius.circular(50),
|
|
// ),
|
|
// child: Align(
|
|
// alignment: AlignmentDirectional(0, 0),
|
|
// child: Text(
|
|
// '搜索',
|
|
// style:
|
|
// FlutterFlowTheme.of(context).bodyMedium.override(
|
|
// fontFamily: 'Readex Pro',
|
|
// color: Colors.white,
|
|
// fontSize: AppFontsize.normal_text_size,
|
|
// letterSpacing: 0,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
);
|
|
}
|
|
}
|