onufitness_mobile/lib/screens/echoboard/widget/privecy_bottom_sheet.dart
2026-01-13 11:36:24 +05:30

96 lines
3.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:onufitness/constants/color_constant.dart';
import 'package:onufitness/screens/echoboard/controllers/echoboard_controller.dart';
import 'package:onufitness/screens/echoboard/views/exclusive_connection_selection_screen.dart';
void showPrivacyBottomSheet(
BuildContext context,
EchoBoardController controller,
) {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(15.r)),
),
isScrollControlled: true,
builder: (_) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadius.circular(2),
),
),
SizedBox(height: 20.h),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Who can see your post?',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
),
SizedBox(height: 15.h),
...controller.visibilityTypes.map((opt) {
return Obx(() {
final selected = controller.visibility.value;
return ListTile(
onTap: () async {
if (opt['label'] == 'Connections') {
final selectedIds = await Get.to(
() => ExclusiveConnectionSelectionScreen(),
);
if (selectedIds != null) {
controller.visibility.value = 'Connections';
}
} else {
controller.visibility.value = opt['label'];
}
},
leading: CircleAvatar(
backgroundColor: Colors.grey[200],
child: Icon(opt['icon'], color: Colors.black),
),
title: Text(opt['label']),
subtitle: Text(opt['description']),
trailing:
opt.containsKey('trailing')
? opt['trailing']
: Radio<String>(
value: opt['label'],
groupValue: selected,
onChanged:
(val) => controller.visibility.value = val!,
fillColor: WidgetStateProperty.resolveWith<Color>((
states,
) {
if (states.contains(WidgetState.selected)) {
return Color(primaryColor);
}
return Colors.grey;
}),
),
);
});
}),
SizedBox(height: 15.h),
Container(
padding: EdgeInsetsDirectional.only(
bottom: MediaQuery.of(context).viewPadding.bottom,
),
color: Colors.white,
),
],
),
);
},
);
}