2022-08-11 12:28:06 +00:00
|
|
|
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';
|
2022-10-19 15:27:40 +00:00
|
|
|
import 'package:photos/theme/text_style.dart';
|
2023-04-21 14:47:47 +00:00
|
|
|
import "package:styled_text/styled_text.dart";
|
2022-08-11 12:28:06 +00:00
|
|
|
|
|
|
|
class SectionTitle extends StatelessWidget {
|
2022-10-19 15:27:40 +00:00
|
|
|
final String? title;
|
2023-04-21 14:47:47 +00:00
|
|
|
final Widget? titleWithBrand;
|
2023-06-22 19:11:23 +00:00
|
|
|
final bool skipMargin;
|
2022-08-11 12:28:06 +00:00
|
|
|
|
2022-10-19 15:27:40 +00:00
|
|
|
const SectionTitle({
|
|
|
|
this.title,
|
|
|
|
this.titleWithBrand,
|
2023-06-22 19:11:23 +00:00
|
|
|
this.skipMargin = false,
|
2022-10-19 15:27:40 +00:00
|
|
|
Key? key,
|
2022-08-11 12:28:06 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-10-19 14:24:20 +00:00
|
|
|
final enteTextTheme = getEnteTextTheme(context);
|
2022-10-19 15:27:40 +00:00
|
|
|
Widget child;
|
|
|
|
if (titleWithBrand != null) {
|
|
|
|
child = titleWithBrand!;
|
|
|
|
} else if (title != null) {
|
|
|
|
child = Text(
|
|
|
|
title!,
|
|
|
|
style: enteTextTheme.largeBold,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
child = const SizedBox.shrink();
|
|
|
|
}
|
2022-08-11 12:28:06 +00:00
|
|
|
return Container(
|
2023-06-23 11:42:22 +00:00
|
|
|
padding: EdgeInsets.only(left: skipMargin ? 0 : 12),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: child,
|
2022-08-11 12:28:06 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2022-10-19 15:27:40 +00:00
|
|
|
|
2023-04-21 14:47:47 +00:00
|
|
|
Widget getOnEnteSection(BuildContext context) {
|
2022-10-26 07:46:36 +00:00
|
|
|
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,
|
2022-10-26 07:46:36 +00:00
|
|
|
),
|
2023-04-21 14:47:47 +00:00
|
|
|
tags: {
|
|
|
|
'branding': StyledTextTag(
|
|
|
|
style: textTheme.brandSmall,
|
|
|
|
),
|
|
|
|
},
|
2022-10-26 07:46:36 +00:00
|
|
|
);
|
|
|
|
}
|