-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: made it easier for users on smaller screens to see baro's inventory
- Loading branch information
1 parent
4d90141
commit e6dbe4d
Showing
2 changed files
with
100 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import 'package:black_hole_flutter/black_hole_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:navis_ui/navis_ui.dart'; | ||
import 'package:warframestat_client/warframestat_client.dart'; | ||
|
||
class TraderItemView extends StatelessWidget { | ||
const TraderItemView({super.key, required this.traderItem}); | ||
|
||
final TraderItem traderItem; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 8), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text( | ||
traderItem.item, | ||
style: context.theme.textTheme.titleMedium, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(top: 8, right: 16), | ||
child: _TraderItemTrailing( | ||
credits: traderItem.credits ?? 0, | ||
ducats: traderItem.ducats ?? 0, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _TraderItemTrailing extends StatelessWidget { | ||
const _TraderItemTrailing({ | ||
required this.credits, | ||
required this.ducats, | ||
}); | ||
|
||
final int credits; | ||
final int ducats; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
height: 65, | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
_TrailingColumn( | ||
header: 'Credits', | ||
value: credits, | ||
), | ||
const SizedBox(width: 25), | ||
_TrailingColumn( | ||
header: 'Ducats', | ||
value: ducats, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _TrailingColumn extends StatelessWidget { | ||
const _TrailingColumn({required this.header, required this.value}); | ||
|
||
final String header; | ||
final int value; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final format = NumberFormat(); | ||
final textTheme = context.textTheme; | ||
final headerStyle = | ||
textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500); | ||
final valueStyle = | ||
textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.w800); | ||
|
||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Text(header, style: headerStyle), | ||
SizedBoxSpacer.spacerHeight6, | ||
Text(format.format(value), style: valueStyle), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters