You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.9 KiB

import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/retrofit_api.dart';
import '../view_widget/my_appbar.dart';
class ImSearch extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _ImSearch();
}
}
class _ImSearch extends State<ImSearch> {
ApiService apiService;
final TextEditingController editingController = TextEditingController();
FocusNode _focusNode = FocusNode();
@override
void initState() {
super.initState();
}
///离开页面记着销毁和清除
@override
void dispose() {
_focusNode.unfocus();
super.dispose();
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap:(){
FocusScope.of(context).requestFocus(FocusNode());
},
child: Scaffold(
backgroundColor: Color(0xFFFFFFFF),
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "",
leading: true,
leadingColor: Colors.black,
background: Color(0xFFFFFFFF),
),
body: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
imSearch(),
// Expanded(
// child: ListView.builder(
// itemCount: 10,
// physics: BouncingScrollPhysics(),
// shrinkWrap: true,
// itemBuilder: (context, position) {
// return imSearch();
// },
// )),
],
),
),
),
);
}
///搜索列表
Widget imSearch() {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w,29.h),
padding: EdgeInsets.symmetric(vertical: 13.h),
decoration: BoxDecoration(
color: Color(0xFFFDFCFC),
borderRadius: BorderRadius.circular(4),
),
child: TextField(
textInputAction: TextInputAction.search,
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode());
},
controller: editingController,
style: TextStyle(
fontSize: 14.sp,
),
decoration: InputDecoration(
hintText: "搜索",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFFA29E9E),
),
isCollapsed: true,
prefixIcon: Padding(
padding: EdgeInsets.only(left: 15.w, right: 5.w),
child: Image.asset(
"assets/image/icon_search.webp",
width: 14.h,
height: 14.h,
color: Color(0xFFB3B3B3),
),
),
prefixIconConstraints: BoxConstraints(),
border: InputBorder.none,
),
),
);
}
}