Skip to content

Commit

Permalink
make Next Up header sticky too
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Mar 31, 2024
1 parent b73898a commit 549d50e
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 220 deletions.
47 changes: 29 additions & 18 deletions lib/components/Buttons/simple_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,42 @@
import 'package:finamp/color_schemes.g.dart';
import 'package:flutter/material.dart';

enum IconPosition {
start,
end,
}

class SimpleButton extends StatelessWidget {
final String text;
final IconData icon;
final IconPosition? iconPosition;
final double iconSize;
final Color? iconColor;
final void Function() onPressed;

const SimpleButton({super.key, required this.text, required this.icon, required this.onPressed});
const SimpleButton({super.key, required this.text, required this.icon, required this.onPressed, this.iconPosition = IconPosition.start, this.iconSize = 20.0, this.iconColor});

@override
Widget build(BuildContext context) {

final contents = [
Icon(
icon,
size: iconSize,
color: iconColor,
weight: 1.5,
),
const SizedBox(width: 6,),
Text(
text,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color!,
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
];

return TextButton(
onPressed: onPressed,
style: ButtonStyle(
Expand All @@ -29,23 +56,7 @@ class SimpleButton extends StatelessWidget {
),
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(
icon,
size: 20,
color: jellyfinBlueColor,
weight: 1.5,
),
const SizedBox(width: 6,),
Text(
text,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color!,
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
children: iconPosition == IconPosition.start ? contents : contents.reversed.toList(),
),
);
}
Expand Down
Loading

0 comments on commit 549d50e

Please sign in to comment.