clean up and test fixes

This commit is contained in:
julian 2022-11-25 17:49:47 -06:00
parent 9fce8ca107
commit 56f54ac487
3 changed files with 63 additions and 58 deletions

View file

@ -1,13 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
class Background extends ConsumerWidget {
class Background extends StatelessWidget {
const Background({
Key? key,
required this.child,
@ -16,12 +14,10 @@ class Background extends ConsumerWidget {
final Widget child;
@override
Widget build(BuildContext context, WidgetRef ref) {
final colorTheme = ref.watch(colorThemeProvider.state).state;
Widget build(BuildContext context) {
Color? color;
switch (colorTheme.themeType) {
switch (Theme.of(context).extension<StackColors>()!.themeType) {
case ThemeType.light:
case ThemeType.dark:
color = Theme.of(context).extension<StackColors>()!.background;

View file

@ -131,55 +131,58 @@ class _EmojiSelectSheetState extends ConsumerState<EmojiSelectSheet> {
SizedBox(
height: isDesktop ? 16 : 12,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop ? false : true,
controller: _searchController,
focusNode: _searchFocusNode,
onChanged: (newString) {
setState(() => _searchTerm = newString);
},
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Search",
_searchFocusNode,
context,
).copyWith(
prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
Material(
color: Colors.transparent,
child: ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop ? false : true,
controller: _searchController,
focusNode: _searchFocusNode,
onChanged: (newString) {
setState(() => _searchTerm = newString);
},
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Search",
_searchFocusNode,
context,
).copyWith(
prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
),
suffixIcon: _searchController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchController.text = "";
_searchTerm = "";
});
},
),
],
suffixIcon: _searchController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchController.text = "";
_searchTerm = "";
});
},
),
],
),
),
),
)
: null,
)
: null,
),
),
),
),

View file

@ -1,8 +1,8 @@
import 'package:emojis/emoji.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:flutter_test/flutter_test.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:stackwallet/utilities/theme/light_colors.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/emoji_select_sheet.dart';
@ -43,15 +43,21 @@ void main() {
],
),
home: mockingjay.MockNavigatorProvider(
navigator: navigator, child: emojiSelectSheet),
navigator: navigator,
child: Column(
children: const [
Expanded(child: emojiSelectSheet),
],
),
),
),
),
);
final gestureDetector = find.byType(GestureDetector).first;
final gestureDetector = find.byType(GestureDetector).at(5);
expect(gestureDetector, findsOneWidget);
final emoji = Emoji.all()[0];
final emoji = Emoji.byChar("😅");
await tester.tap(gestureDetector);
await tester.pumpAndSettle();