fix(flutter): 统一下拉刷新主色文案
This commit is contained in:
1 parent
69eaacd74f
commit
107ae40d2a
2 files changed
+19
-7
No files matched your search
@@ -173,15 +173,14 @@ class _AppPullToRefreshState extends State<AppPullToRefresh> {
|
|||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.arrow_downward_rounded,
|
Icons.arrow_downward_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: armed ? AppColors.blue : AppColors.muted,
|
color: AppColors.blue,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
armed ? l10n.releaseToRefresh : l10n.pullToRefresh,
|
armed ? l10n.releaseToRefresh : l10n.pullToRefresh,
|
||||||
emphasized: armed,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _label(Widget icon, String text, {bool emphasized = false}) {
|
Widget _label(Widget icon, String text) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -189,10 +188,10 @@ class _AppPullToRefreshState extends State<AppPullToRefresh> {
|
|||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
text,
|
text,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: emphasized ? AppColors.blue : AppColors.muted,
|
color: AppColors.blue,
|
||||||
fontSize: 12,
|
fontSize: 13,
|
||||||
fontWeight: emphasized ? FontWeight.w700 : FontWeight.w500,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||||
import 'package:fruitshorts/core/widgets/app_pull_to_refresh.dart';
|
import 'package:fruitshorts/core/widgets/app_pull_to_refresh.dart';
|
||||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||||
|
|
||||||
@@ -43,14 +44,26 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(scrollable.position.pixels, lessThan(0));
|
expect(scrollable.position.pixels, lessThan(0));
|
||||||
expect(find.text('Pull to refresh'), findsOneWidget);
|
expect(find.text('Pull to refresh'), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.widget<Text>(find.text('Pull to refresh')).style?.color,
|
||||||
|
AppColors.blue,
|
||||||
|
);
|
||||||
|
|
||||||
await gesture.moveBy(const Offset(0, 120));
|
await gesture.moveBy(const Offset(0, 120));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.text('Release to refresh'), findsOneWidget);
|
expect(find.text('Release to refresh'), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.widget<Text>(find.text('Release to refresh')).style?.color,
|
||||||
|
AppColors.blue,
|
||||||
|
);
|
||||||
|
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.text('Refreshing…'), findsOneWidget);
|
expect(find.text('Refreshing…'), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.widget<Text>(find.text('Refreshing…')).style?.color,
|
||||||
|
AppColors.blue,
|
||||||
|
);
|
||||||
expect(calls, 1);
|
expect(calls, 1);
|
||||||
|
|
||||||
final duplicate = await tester.startGesture(
|
final duplicate = await tester.startGesture(
|
||||||
|
|||||||
Reference in new issue
Block a user