86 lines
2.6 KiB
Dart
86 lines
2.6 KiB
Dart
import 'package:flutter/material.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) {
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: AppDimensions.horizontalPadding,
|
|
),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.background,
|
|
borderRadius: BorderRadius.circular(AppDimensions.borderRadius),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0x0D000000),
|
|
blurRadius: AppDimensions.cardShadowBlur,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'问题描述',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
TextField(
|
|
maxLines: 5,
|
|
maxLength: 200,
|
|
onChanged: onChanged,
|
|
decoration: InputDecoration(
|
|
hintText: '请详细描述问题现象...',
|
|
hintStyle: TextStyle(color: AppColors.textHint),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
|
borderSide: BorderSide(color: AppColors.borderColor),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
|
borderSide: BorderSide(color: AppColors.borderColor),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
|
borderSide: BorderSide(color: AppColors.primary, width: 2),
|
|
),
|
|
counterText: '',
|
|
),
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Text(
|
|
'${description?.length ?? 0}/200',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.textHint,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|