Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:dynamic_color/dynamic_color.dart';
import 'package:wear_bridge/wear_bridge.dart';
import 'dart:core';

const _flavor = String.fromEnvironment("edu.rit.csh.devin.flavor",
defaultValue: "mobile");
const _flavor =
String.fromEnvironment("edu.rit.csh.devin.flavor", defaultValue: "mobile");

void main() {
runApp(const MyApp());
Expand Down Expand Up @@ -215,6 +215,7 @@ class _MyHomePageState extends State<MyHomePage> {
Widget _buildSlot(
BuildContext context, ThinMachine machine, MachineSlot slot) {
final icon = Icon(machine.icon, semanticLabel: machine.name);
final name = slot.item.name;

void onDrop() {
setState(() {
Expand Down Expand Up @@ -259,32 +260,32 @@ class _MyHomePageState extends State<MyHomePage> {
: null,
child: Chip(
avatar: icon,
label: Text(slot.item.name),
label: Text(name),
));
});
}

return Card(
child: ListTile(
title: Row(children: [
Text(slot.item.name),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
customBorder: const StadiumBorder(),
onTap: () {
setState(() {
_usdUnit = !_usdUnit;
});
},
child: Chip(
avatar: const Icon(Icons.attach_money,
semanticLabel: "Price"),
label: Text(_usdUnit
? ("\$${(slot.item.price / 100).toStringAsFixed(2)}")
: ("${slot.item.price.toString()} Credits")),
))))
title:
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Flexible(child: Text(name)),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: InkWell(
customBorder: const StadiumBorder(),
onTap: () {
setState(() {
_usdUnit = !_usdUnit;
});
},
child: Chip(
avatar:
const Icon(Icons.attach_money, semanticLabel: "Price"),
label: Text(_usdUnit
? ("\$${(slot.item.price / 100).toStringAsFixed(2)}")
: ("${slot.item.price.toString()} Credits")),
)))
]),
subtitle: FutureBuilder<int?>(
future: _creditCount,
Expand All @@ -295,11 +296,10 @@ class _MyHomePageState extends State<MyHomePage> {
alignment: Alignment.centerLeft,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
Theme.of(context).colorScheme.primary,
foregroundColor:
Theme.of(context).colorScheme.onPrimary,
),
backgroundColor:
Theme.of(context).colorScheme.primary,
foregroundColor:
Theme.of(context).colorScheme.onPrimary),
onPressed: ((snapshot.data == null ||
snapshot.data! >= slot.item.price) &&
_dropping == null)
Expand Down