import 'package:flutter/material.dart'; import '../models/ItemModel.dart'; import '../utils/colors.dart'; import 'custom_text.dart'; class SettingTile extends StatelessWidget { final SettingItem item; final bool isSelected; final bool isDarkMode; final bool isInSelectionMode; const SettingTile({required this.item,required this.isDarkMode, this.isSelected = false,this.isInSelectionMode = false,}); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( border: Border.all(color:const Color(0xFFE8E8E8)), borderRadius: BorderRadius.circular(32), ), padding: const EdgeInsets.all(16.0), child: InkWell( onTap: item.onTap, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: item.subtitle != null ? Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ Txt( text: item.title, style: TextStyle( color: isDarkMode ? AppColors.white : AppColors.black, fontSize: 18, fontFamily: 'Inter', fontWeight: FontWeight.w600, height: 1.33, ), ), Txt( text: item.subtitle!, style:const TextStyle( color: Color(0xFF5B616D) , fontSize: 15, fontFamily: 'Inter', fontWeight: FontWeight.w500, height: 1.60, ), ), ], ) : Txt( text: item.title, style: TextStyle( fontSize: 17, color: isDarkMode ? AppColors.white : AppColors.black, fontWeight: FontWeight.w700, ), ), ), isInSelectionMode ? (isSelected ? const Icon(Icons.check, color: Colors.orange) : const SizedBox.shrink()) : _buildTrailingWidget(), ], ), ), ); } Widget _buildTrailingWidget() { if (item.switchValue != null && item.onSwitchChanged != null) { return Switch( value: item.switchValue!, onChanged: item.onSwitchChanged, activeColor: item.color, inactiveThumbColor: Colors.grey, activeTrackColor: item.color.withOpacity(.4), ); } return const Icon(Icons.arrow_forward_ios_sharp, size: 16); } }