content localized on locale change

This commit is contained in:
2024-12-18 19:30:13 +01:00
parent a984fc15b0
commit 6587828a0b
9 changed files with 158 additions and 94 deletions

View File

@@ -3,32 +3,29 @@ import 'package:resume/widgets/content_list_tile.dart';
import 'package:resume/widgets/language_widget.dart';
import 'package:resume/constants.dart' show ContentType;
import '../services/content_provider.dart';
class ContentBlock extends StatelessWidget {
const ContentBlock({
super.key,
required this.blockTitle,
required this.contentType,
required this.content,
});
final String blockTitle;
final ContentType contentType;
final dynamic content;
Widget get _getContentWidget {
if (contentType == ContentType.language) {
return const LanguageWidget();
} else if (contentType == ContentType.text ||
contentType == ContentType.generalSkills) {
final content = ContentProvider.getContent<String>(contentType);
return SizedBox(
width: double.infinity,
child: Text(content),
);
}
// List-based content-blocks
List<dynamic> content =
ContentProvider.getContent<List<dynamic>>(contentType);
List<Widget> widgets = [];
for (var item in content) {
widgets.add(_buildListTile(item));