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.
99 lines
3.3 KiB
Dart
99 lines
3.3 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:tangheem/api/user_api_client.dart';
|
|
import 'package:tangheem/classes/colors.dart';
|
|
import 'package:tangheem/classes/utils.dart';
|
|
import 'package:tangheem/widgets/common_textfield_widget.dart';
|
|
import 'package:tangheem/widgets/otp_widget.dart';
|
|
|
|
class DiscussionInputDialog extends StatefulWidget {
|
|
final Function(String) onCommentPress;
|
|
DiscussionInputDialog({Key key, this.onCommentPress}) : super(key: key);
|
|
|
|
@override
|
|
_DiscussionInputDialogState createState() {
|
|
return _DiscussionInputDialogState();
|
|
}
|
|
}
|
|
|
|
class _DiscussionInputDialogState extends State<DiscussionInputDialog> {
|
|
final TextEditingController _commentController = TextEditingController();
|
|
final FocusNode _focusNode = FocusNode();
|
|
|
|
bool hasError = false;
|
|
String errorMessage;
|
|
String otpMessage = "";
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_focusNode.requestFocus();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
elevation: 0,
|
|
backgroundColor: Colors.transparent,
|
|
child: Directionality(
|
|
textDirection: TextDirection.rtl,
|
|
child: Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: ColorConsts.primaryBlue,
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
"اضاف تعليق",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 16),
|
|
),
|
|
SizedBox(height: 12),
|
|
CommonTextFieldWidget(hint: "فحوى التعليق", controller: _commentController, maxLines: 5, focusNode: _focusNode),
|
|
SizedBox(height: 12),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 40,
|
|
child: TextButton(
|
|
onPressed: () {
|
|
if (_commentController.text.length < 1) {
|
|
Utils.showToast("يجب أن تكتب كلمات قليلة");
|
|
return;
|
|
}
|
|
_focusNode.unfocus();
|
|
widget.onCommentPress(_commentController.text);
|
|
},
|
|
style: TextButton.styleFrom(
|
|
primary: Colors.white,
|
|
padding: EdgeInsets.all(2),
|
|
backgroundColor: ColorConsts.secondaryPink,
|
|
textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
),
|
|
),
|
|
child: Text("أضف تعليقك"),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|