mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-03-11 17:49:27 -05:00
refactor: language bar
This commit is contained in:
@@ -19,13 +19,14 @@ class LanguageBar extends StatelessWidget {
|
|||||||
const LanguageBar(this.items);
|
const LanguageBar(this.items);
|
||||||
final List<LanguageBarItem> items;
|
final List<LanguageBarItem> items;
|
||||||
|
|
||||||
|
static const _padding = 8.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final langWidth = MediaQuery.of(context).size.width -
|
final langWidth = MediaQuery.of(context).size.width -
|
||||||
CommonStyle.padding.left -
|
_padding * 2 - // left, right
|
||||||
CommonStyle.padding.right -
|
(items.length - 1) - // space between items
|
||||||
items.length +
|
1; // buffer for rounding
|
||||||
1;
|
|
||||||
|
|
||||||
return CupertinoButton(
|
return CupertinoButton(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
@@ -37,23 +38,20 @@ class LanguageBar extends StatelessWidget {
|
|||||||
builder: _buildPopup,
|
builder: _buildPopup,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Padding(
|
||||||
// color: AntTheme.of(context).background,
|
padding: const EdgeInsets.all(_padding),
|
||||||
padding: CommonStyle.padding.copyWith(top: 8, bottom: 8),
|
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(100),
|
||||||
child: SizedBox(
|
child: Wrap(
|
||||||
height: 10,
|
spacing: 1,
|
||||||
child: Row(
|
children: [
|
||||||
children: join(
|
for (final lang in items)
|
||||||
const SizedBox(width: 1),
|
Container(
|
||||||
items
|
color: fromCssColor(lang.hexColor!),
|
||||||
.map((lang) => Container(
|
width: langWidth * lang.ratio!,
|
||||||
color: fromCssColor(lang.hexColor!),
|
height: 12,
|
||||||
width: langWidth * lang.ratio!))
|
)
|
||||||
.toList(),
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user