aves/lib/widgets/common/basic/menu_row.dart
Thibault Deckers 0dbb46d9bb const galore
2021-06-08 11:05:23 +09:00

37 lines
908 B
Dart

import 'package:aves/theme/icons.dart';
import 'package:flutter/material.dart';
class MenuRow extends StatelessWidget {
final String text;
final IconData? icon;
final bool? checked;
const MenuRow({
Key? key,
required this.text,
this.icon,
this.checked,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
final iconSize = IconTheme.of(context).size! * textScaleFactor;
return Row(
children: [
if (checked != null) ...[
Opacity(
opacity: checked! ? 1 : 0,
child: Icon(AIcons.checked, size: iconSize),
),
const SizedBox(width: 8),
],
if (icon != null) ...[
Icon(icon, size: iconSize),
const SizedBox(width: 8),
],
Expanded(child: Text(text)),
],
);
}
}