mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
95 lines
2.8 KiB
Dart
95 lines
2.8 KiB
Dart
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class SettingWidget extends StatelessWidget {
|
|
final String? text;
|
|
final bool? isUpdate;
|
|
final bool? value;
|
|
final bool? isNotification;
|
|
final String? icon;
|
|
final Function()? onTap;
|
|
final Function()? onTapUpdate;
|
|
final Function(bool)? onChanged;
|
|
const SettingWidget(
|
|
{super.key,
|
|
this.text,
|
|
this.icon,
|
|
this.value,
|
|
this.onTap,
|
|
this.isUpdate,
|
|
this.onChanged,
|
|
this.isNotification = false,
|
|
this.onTapUpdate});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: const BoxDecoration(
|
|
color: ColorsManager.primaryColor,
|
|
borderRadius: BorderRadius.all(Radius.circular(20))),
|
|
child: SvgPicture.asset(
|
|
icon!,
|
|
fit: BoxFit.none,
|
|
height: 30,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(
|
|
width: 8,
|
|
),
|
|
Expanded(
|
|
flex: isUpdate == true ? 5 : 10,
|
|
child: BodyMedium(
|
|
text: text!,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w400,
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
isUpdate == true
|
|
? InkWell(
|
|
onTap: onTapUpdate,
|
|
child: const BodyMedium(
|
|
text: '1 Update Available',
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w400,
|
|
fontColor: ColorsManager.blueColor,
|
|
),
|
|
)
|
|
: const SizedBox(),
|
|
isNotification == false
|
|
? const Icon(
|
|
Icons.arrow_forward_ios,
|
|
color: ColorsManager.graysColor,
|
|
size: 20,
|
|
)
|
|
: Transform.scale(
|
|
scale: .8,
|
|
child: CupertinoSwitch(
|
|
value: value!,
|
|
onChanged: onChanged,
|
|
applyTheme: true,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|