mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
@@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
@@ -19,45 +21,51 @@ class SearchBar extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.searchBackground(themeData),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
ExcludeSemantics(
|
||||
child: Icon(
|
||||
CupertinoIcons.search,
|
||||
color: Styles.searchIconColor,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoTextField(
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
decoration: null,
|
||||
style: Styles.searchText(themeData),
|
||||
cursorColor: Styles.searchCursorColor,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.clear();
|
||||
},
|
||||
child: Icon(
|
||||
CupertinoIcons.clear_thick_circled,
|
||||
semanticLabel: 'Clear search terms',
|
||||
color: Styles.searchIconColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: BackdropFilter(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.searchBackground(themeData),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
ExcludeSemantics(
|
||||
child: Icon(
|
||||
CupertinoIcons.search,
|
||||
color: Styles.searchIconColor,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoTextField(
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
decoration: null,
|
||||
style: Styles.searchText(themeData),
|
||||
cursorColor: Styles.searchCursorColor,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.clear();
|
||||
},
|
||||
child: Icon(
|
||||
CupertinoIcons.clear_thick_circled,
|
||||
semanticLabel: 'Clear search terms',
|
||||
color: Styles.searchIconColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
filter: ImageFilter.blur(sigmaY: 5, sigmaX: 5),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user