forked from firka/student-legacy
55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:refilc/theme/colors/colors.dart';
|
|
|
|
class SidebarAction extends StatelessWidget {
|
|
const SidebarAction(
|
|
{super.key, this.title, this.icon, this.onTap, this.selected = false});
|
|
|
|
final bool selected;
|
|
final Widget? icon;
|
|
final Widget? title;
|
|
final Function()? onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 12.0),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
children: [
|
|
if (icon != null)
|
|
IconTheme(
|
|
data: IconThemeData(
|
|
color: AppColors.of(context)
|
|
.text
|
|
.withOpacity(selected ? 1.0 : .3),
|
|
),
|
|
child: icon!,
|
|
),
|
|
if (title != null)
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 24.0),
|
|
child: AnimatedDefaultTextStyle(
|
|
duration: const Duration(milliseconds: 500),
|
|
style: TextStyle(
|
|
color: AppColors.of(context)
|
|
.text
|
|
.withOpacity(selected ? 1.0 : .8),
|
|
fontWeight: FontWeight.w500,
|
|
fontFamily: "Montserrat",
|
|
),
|
|
child: title!,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|