ente/lib/ui/tabs/section_title.dart

65 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2023-04-21 14:47:47 +00:00
import "package:photos/generated/l10n.dart";
2022-10-19 14:24:20 +00:00
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/theme/text_style.dart';
2023-04-21 14:47:47 +00:00
import "package:styled_text/styled_text.dart";
class SectionTitle extends StatelessWidget {
final String? title;
2023-04-21 14:47:47 +00:00
final Widget? titleWithBrand;
final bool skipMargin;
const SectionTitle({
this.title,
this.titleWithBrand,
this.skipMargin = false,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
2022-10-19 14:24:20 +00:00
final enteTextTheme = getEnteTextTheme(context);
Widget child;
if (titleWithBrand != null) {
child = titleWithBrand!;
} else if (title != null) {
child = Text(
title!,
style: enteTextTheme.largeBold,
);
} else {
child = const SizedBox.shrink();
}
return Container(
margin: skipMargin ? null : const EdgeInsets.only(left: 16),
child: Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: child,
),
],
),
);
}
}
2023-04-21 14:47:47 +00:00
Widget getOnEnteSection(BuildContext context) {
final EnteTextTheme textTheme = getEnteTextTheme(context);
2023-04-21 14:47:47 +00:00
return StyledText(
text: S.of(context).onEnte,
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
fontSize: 21,
color: textTheme.brandSmall.color,
),
2023-04-21 14:47:47 +00:00
tags: {
'branding': StyledTextTag(
style: textTheme.brandSmall,
),
},
);
}