92 lines
3.0 KiB
Dart
92 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
|
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
|
import '../constants/report_constants.dart';
|
|
|
|
/// 问题描述输入模块
|
|
class DescriptionInput extends StatelessWidget {
|
|
final String? description;
|
|
final Function(String) onChanged;
|
|
|
|
const DescriptionInput({
|
|
super.key,
|
|
this.description,
|
|
required this.onChanged,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final loc = AppLocalizations.of(context);
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: AppDimensions.horizontalPadding,
|
|
),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: context.appColors.cardBackground,
|
|
borderRadius: BorderRadius.circular(AppDimensions.borderRadius),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: context.appColors.cardShadow,
|
|
blurRadius: AppDimensions.cardShadowBlur,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
loc.translate('report.problem_description'),
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: context.appColors.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
TextField(
|
|
maxLines: 5,
|
|
maxLength: 200,
|
|
onChanged: onChanged,
|
|
decoration: InputDecoration(
|
|
hintText: loc.translate('report.description_hint'),
|
|
hintStyle: TextStyle(color: context.appColors.textTertiary),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(
|
|
AppDimensions.borderRadiusSmall,
|
|
),
|
|
borderSide: BorderSide(color: context.appColors.divider),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(
|
|
AppDimensions.borderRadiusSmall,
|
|
),
|
|
borderSide: BorderSide(color: context.appColors.divider),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(
|
|
AppDimensions.borderRadiusSmall,
|
|
),
|
|
borderSide: BorderSide(
|
|
color: context.appColors.primary,
|
|
width: 2,
|
|
),
|
|
),
|
|
counterText: '',
|
|
),
|
|
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
|
|
),
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Text(
|
|
'${description?.length ?? 0}/200',
|
|
style: TextStyle(fontSize: 12, color: context.appColors.textTertiary),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|