104 lines
3.5 KiB
Dart
104 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:google_fonts/google_fonts.dart';
|
||
|
||
/// 选图校验失败:文件超过上传上限(醒目 SnackBar)。
|
||
void showImageExceedsMaxUploadSnackBar(BuildContext context) {
|
||
final m = ScaffoldMessenger.of(context);
|
||
m.hideCurrentSnackBar();
|
||
m.showSnackBar(
|
||
SnackBar(
|
||
behavior: SnackBarBehavior.floating,
|
||
margin: const EdgeInsets.fromLTRB(12, 0, 12, 20),
|
||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||
backgroundColor: const Color(0xFFB42318),
|
||
elevation: 10,
|
||
duration: const Duration(seconds: 5),
|
||
content: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
const Icon(Icons.warning_rounded, color: Colors.white, size: 28),
|
||
const SizedBox(width: 12),
|
||
Expanded(
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.min,
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
'Image too large',
|
||
style: GoogleFonts.inter(
|
||
fontSize: 16,
|
||
fontWeight: FontWeight.w800,
|
||
color: Colors.white,
|
||
height: 1.2,
|
||
letterSpacing: -0.2,
|
||
),
|
||
),
|
||
const SizedBox(height: 6),
|
||
Text(
|
||
'This file is over the upload size limit. Please choose a smaller image.',
|
||
style: GoogleFonts.inter(
|
||
fontSize: 13,
|
||
fontWeight: FontWeight.w600,
|
||
color: Colors.white.withValues(alpha: 0.94),
|
||
height: 1.4,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
/// 因上限变更,已选图片被清空时的提示。
|
||
void showImageClearedOverLimitSnackBar(BuildContext context) {
|
||
final m = ScaffoldMessenger.of(context);
|
||
m.hideCurrentSnackBar();
|
||
m.showSnackBar(
|
||
SnackBar(
|
||
behavior: SnackBarBehavior.floating,
|
||
margin: const EdgeInsets.fromLTRB(12, 0, 12, 20),
|
||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||
backgroundColor: const Color(0xFFC2410C),
|
||
elevation: 10,
|
||
duration: const Duration(seconds: 5),
|
||
content: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
const Icon(Icons.info_outline_rounded, color: Colors.white, size: 26),
|
||
const SizedBox(width: 12),
|
||
Expanded(
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.min,
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
'Selection cleared',
|
||
style: GoogleFonts.inter(
|
||
fontSize: 15,
|
||
fontWeight: FontWeight.w800,
|
||
color: Colors.white,
|
||
height: 1.2,
|
||
),
|
||
),
|
||
const SizedBox(height: 6),
|
||
Text(
|
||
'Your previous image(s) were over the new size limit and have been removed.',
|
||
style: GoogleFonts.inter(
|
||
fontSize: 13,
|
||
fontWeight: FontWeight.w600,
|
||
color: Colors.white.withValues(alpha: 0.94),
|
||
height: 1.4,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|