282 lines
12 KiB
Dart
282 lines
12 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:dotted_border/dotted_border.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:regroup/Common/CommonButton.dart';
|
|
import 'package:regroup/Common/CommonGlassmorphism.dart';
|
|
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
|
import 'package:regroup/Utils/Common/CommonDropdown.dart';
|
|
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
|
import 'package:regroup/Utils/Common/ImageUpload.dart';
|
|
import 'package:regroup/Utils/Common/blureffect.dart';
|
|
import 'package:regroup/Utils/Common/sized_box.dart';
|
|
import 'package:regroup/Utils/texts.dart';
|
|
|
|
class NewPost extends StatefulWidget {
|
|
const NewPost({super.key});
|
|
|
|
@override
|
|
State<NewPost> createState() => _NewPostState();
|
|
}
|
|
|
|
class _NewPostState extends State<NewPost> {
|
|
List<File?> bannerPath = [];
|
|
bool isbannerAdded = false;
|
|
var selectedContainerIndices = <int>{}.obs;
|
|
|
|
void toggleSelectedIndex(int index) {
|
|
if (selectedContainerIndices.contains(index)) {
|
|
selectedContainerIndices.remove(index);
|
|
} else {
|
|
selectedContainerIndices.add(index);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
// key: _scaffoldKey1,
|
|
backgroundColor: Color(0xFF222935),
|
|
extendBody: true,
|
|
resizeToAvoidBottomInset: false,
|
|
appBar: CommonAppbar(
|
|
titleTxt: "New post",
|
|
),
|
|
body: Stack(children: [
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
|
fit: BoxFit.fill)),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
sizedBoxHeight(30.h),
|
|
text16w400_FCFCFC("Caption"),
|
|
sizedBoxHeight(20.h),
|
|
CustomTextFormField2(
|
|
maxlines: 3,
|
|
),
|
|
text16400white("Media"),
|
|
sizedBoxHeight(15.h),
|
|
GestureDetector(
|
|
onTap: () {
|
|
ImageUploadBottomSheet().showModal(
|
|
context,
|
|
false,
|
|
(result) {
|
|
var file = File(result);
|
|
|
|
bannerPath.add(file);
|
|
isbannerAdded = true;
|
|
setState(() {});
|
|
},
|
|
);
|
|
},
|
|
child: DottedBorder(
|
|
strokeWidth: 1,
|
|
dashPattern: [7, 4],
|
|
borderType: BorderType.RRect,
|
|
radius: Radius.circular(14.r),
|
|
color: Color(0xFF434A53),
|
|
child: commonGlassContainer(
|
|
border: 0,
|
|
width: double.infinity,
|
|
height: 130.h,
|
|
borderradius: 10.r,
|
|
customWidget: bannerPath.isNotEmpty && isbannerAdded
|
|
? Stack(children: [
|
|
Image.file(
|
|
bannerPath[0]!,
|
|
fit: BoxFit.cover,
|
|
width: double.infinity,
|
|
),
|
|
Positioned(
|
|
right: 5,
|
|
bottom: 5,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
bannerPath.clear();
|
|
isbannerAdded = false;
|
|
setState(() {});
|
|
},
|
|
child: Container(
|
|
width: 27,
|
|
height: 27,
|
|
decoration: ShapeDecoration(
|
|
color: Color(0xFF7E7E7E),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius:
|
|
BorderRadius.circular(
|
|
5)),
|
|
),
|
|
child: Icon(
|
|
Icons.delete_outline_outlined,
|
|
color: Colors.white,
|
|
))),
|
|
),
|
|
])
|
|
: Padding(
|
|
padding:
|
|
EdgeInsets.symmetric(vertical: 16.h),
|
|
child: Column(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset(
|
|
"assets/images/png/file 1.png",
|
|
height: 44.h,
|
|
width: 44.w,
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
children: [
|
|
text8w400_white(
|
|
"Drag and Drop file here or "),
|
|
text8w700_white("Choose file")
|
|
],
|
|
),
|
|
sizedBoxHeight(8.h),
|
|
]),
|
|
)),
|
|
),
|
|
),
|
|
sizedBoxHeight(20.h),
|
|
text16w400_FCFCFC("Tags"),
|
|
sizedBoxHeight(18.h),
|
|
CustomDropDownTag1(
|
|
header: "Enter tags",
|
|
title: "Enter tags",
|
|
listData: [
|
|
"#Race",
|
|
"#Swimming",
|
|
"#Cycle",
|
|
"#Swimming",
|
|
"#Race"
|
|
],
|
|
rowData: [
|
|
"23,233 Recently use tags",
|
|
"15,123 Recently use tags",
|
|
"15,123 Recently use tags",
|
|
"15,123 Available tags",
|
|
"15,123 Available tags"
|
|
],
|
|
onItemSelected: (p0) {},
|
|
leadingImage: SizedBox()),
|
|
// CustomTextFormField(
|
|
// suffixIcon: Container(
|
|
// height: 20.h,
|
|
// width: 20.w,
|
|
// child: Center(
|
|
// child: Image.asset(
|
|
// "assets/images/png/Frame 58575.png",
|
|
// height: 20.h,
|
|
// width: 20.w,
|
|
// fit: BoxFit.cover,
|
|
// ),
|
|
// ),
|
|
// )),
|
|
sizedBoxHeight(25.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
containerTile(text: "# Race", index: 0),
|
|
containerTile(text: "# Swimming", index: 1),
|
|
containerTile(text: "# Cycle", index: 2),
|
|
],
|
|
),
|
|
sizedBoxHeight(16.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
containerTile(text: "# Race", index: 3),
|
|
containerTile(text: "# Swimming", index: 4),
|
|
containerTile(text: "# Cycle", index: 5),
|
|
],
|
|
),
|
|
sizedBoxHeight(30.h),
|
|
// text16w400_FCFCFC("CTA Title"),
|
|
// sizedBoxHeight(18.h),
|
|
// CustomTextFormField(),
|
|
// sizedBoxHeight(25.h),
|
|
// text16w400_FCFCFC("Post as"),
|
|
// sizedBoxHeight(18.h),
|
|
// CustomDropDownRadio(
|
|
// header: "",
|
|
// title: "",
|
|
// listData: ['Individual', 'Anonymous'],
|
|
// onItemSelected: (p0) {},
|
|
// leadingImage: SizedBox()),
|
|
// CommonDropdownradioBtn(
|
|
// hint: '', items: ['Individual', 'Anonymous']),
|
|
|
|
sizedBoxHeight(25.h),
|
|
text16w400_FCFCFC("Post in"),
|
|
sizedBoxHeight(18.h),
|
|
CustomDropDownCheckBox(
|
|
header: "",
|
|
title: "",
|
|
listData: [
|
|
'Active alliance network',
|
|
'Fitfam federation',
|
|
'The athletic town',
|
|
'Football fever'
|
|
],
|
|
onItemSelected: (p0) {},
|
|
images: [
|
|
'assets/images/png/Rectangle 65.png',
|
|
'assets/images/png/Rectangle 66.png',
|
|
'assets/images/png/Rectangle 60.png',
|
|
'assets/images/png/Rectangle 68.png'
|
|
],
|
|
leadingImage: SizedBox()),
|
|
|
|
sizedBoxHeight(40.h),
|
|
CommonBtn(
|
|
text: 'Submit post',
|
|
onTap: () {
|
|
// successBottomsheet();
|
|
},
|
|
),
|
|
sizedBoxHeight(60.h),
|
|
]),
|
|
),
|
|
)
|
|
]));
|
|
}
|
|
|
|
Widget containerTile({
|
|
required String text,
|
|
required int index,
|
|
}) {
|
|
return Obx(() {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
toggleSelectedIndex(index);
|
|
},
|
|
child: Container(
|
|
height: 35,
|
|
decoration: BoxDecoration(
|
|
color: selectedContainerIndices.contains(index)
|
|
? Color(0xFFD90B2E).withOpacity(0.4)
|
|
: Color(0xFFFFFFFF).withOpacity(0.2),
|
|
borderRadius: BorderRadius.circular(30),
|
|
border: Border.all(color: Color(0xFFD90B2E), width: 1)),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: Center(child: text14w400_FCFCFC(text)),
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|