43 lines
1.1 KiB
Dart
43 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import '../models/language.dart';
|
|
import '../utils/list_utils.dart';
|
|
|
|
class MyLanguageList extends StatelessWidget {
|
|
final List<Language> langList;
|
|
final double? iconHeight;
|
|
final double? textSize;
|
|
|
|
const MyLanguageList(
|
|
{super.key, required this.langList, this.iconHeight = 16, this.textSize});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
List<Language> sortedLanguages = sortLanguageList(langList);
|
|
|
|
return Wrap(
|
|
children: sortedLanguages.map(
|
|
(language) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
SvgPicture.asset(
|
|
language.iconFile,
|
|
height: iconHeight,
|
|
),
|
|
const SizedBox(width: 4.0),
|
|
Text(
|
|
language.name,
|
|
style: TextStyle(fontSize: textSize),
|
|
),
|
|
// Space between each language icon pair
|
|
const SizedBox(width: 8.0),
|
|
],
|
|
);
|
|
},
|
|
).toList(),
|
|
);
|
|
}
|
|
}
|