40 lines
1.0 KiB
Dart
40 lines
1.0 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import '../../core/theme/design_tokens.dart';
|
||
|
|
import 'app_button.dart';
|
||
|
|
|
||
|
|
class ErrorRetrySurface extends StatelessWidget {
|
||
|
|
const ErrorRetrySurface({
|
||
|
|
super.key,
|
||
|
|
required this.message,
|
||
|
|
required this.onRetry,
|
||
|
|
this.horizontalPadding = AppSpacing.xl,
|
||
|
|
});
|
||
|
|
|
||
|
|
final String message;
|
||
|
|
final VoidCallback onRetry;
|
||
|
|
final double horizontalPadding;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Center(
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||
|
|
child: Column(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
Text(
|
||
|
|
message,
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
style: const TextStyle(color: AppColors.red500),
|
||
|
|
),
|
||
|
|
const SizedBox(height: AppSpacing.md),
|
||
|
|
AppButton(text: '重试', onPressed: onRetry),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|