You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.9 KiB
Dart
95 lines
2.9 KiB
Dart
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CustomEditableText extends StatefulWidget {
|
|
CustomEditableText({
|
|
Key key,
|
|
required this.controller,
|
|
this.hint,
|
|
this.isEditable = false, this.isSubmitted,
|
|
}) : super(key: key);
|
|
|
|
final TextEditingController controller;
|
|
|
|
final String hint;
|
|
bool isEditable;
|
|
final bool isSubmitted;
|
|
|
|
@override
|
|
_CustomEditableTextState createState() => _CustomEditableTextState();
|
|
}
|
|
|
|
class _CustomEditableTextState extends State<CustomEditableText> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
if(!widget.isEditable)
|
|
Container(
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[300],
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
border: Border.fromBorderSide(
|
|
BorderSide(
|
|
color: Colors.grey[300],
|
|
width: 2,
|
|
),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(widget.hint, fontSize: 12, color: Colors.black),
|
|
AppText(
|
|
widget.controller.text,
|
|
fontSize: 12,
|
|
color: Colors.grey[600],
|
|
),
|
|
],
|
|
),
|
|
InkWell(
|
|
child: Icon(
|
|
DoctorApp.edit_1,
|
|
size: 20,
|
|
|
|
),
|
|
onTap: () {
|
|
setState(() {
|
|
widget.isEditable = true;
|
|
});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if(widget.isEditable)
|
|
AppTextFieldCustom(
|
|
hintText: widget.hint,
|
|
//TranslationBase.of(context).addoperationReports,
|
|
controller: widget.controller,
|
|
validationError: widget.controller
|
|
.text.isEmpty &&
|
|
widget.isSubmitted
|
|
? TranslationBase.of(context)
|
|
.emptyMessage
|
|
: null,
|
|
maxLines: 1,
|
|
minLines: 1,
|
|
hasBorder: true,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
} |