// Author: fruit.com.cn import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:fruitshorts/core/theme/app_colors.dart'; import 'package:fruitshorts/core/widgets/glass_panel.dart'; void main() { testWidgets('should_blur_and_paint_a_bordered_glass_surface', (tester) async { await tester.pumpWidget( const MaterialApp( home: Scaffold( body: Center( child: GlassPanel( radius: 26, padding: EdgeInsets.all(16), child: Text('glass'), ), ), ), ), ); final filter = tester.widget(find.byType(BackdropFilter)); expect(filter.filter, isNotNull); expect(find.text('glass'), findsOneWidget); final clip = tester.widget(find.byType(ClipRRect).first); expect(clip.borderRadius, BorderRadius.circular(26)); final decorated = tester.widget( find .descendant( of: find.byType(GlassPanel), matching: find.byType(DecoratedBox), ) .first, ); final decoration = decorated.decoration as BoxDecoration; expect(decoration.gradient, isA()); expect(decoration.border!.top.color, AppColors.glassBorder); }); }