Skip to content

Commit

Permalink
Update Calculator Screens (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhoman authored May 8, 2024
1 parent 12a4958 commit 9aece34
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 288 deletions.
22 changes: 12 additions & 10 deletions lib/app/widgets/currency_dropdown.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:genius_api/genius_api.dart';
import 'package:genius_wallet/theme/genius_wallet_colors.g.dart';
import 'package:genius_wallet/theme/genius_wallet_consts.dart';

class CurrencyDropdown extends StatelessWidget {
final List<Currency> currencies;
Expand All @@ -17,28 +19,28 @@ class CurrencyDropdown extends StatelessWidget {
final items = currencies.map((currency) {
return DropdownMenuItem<Currency>(
value: currency,
child: Text(
currency.name,
style: const TextStyle(
fontSize: 30,
),
child: Container(
padding: const EdgeInsets.all(5),
child: Text(currency.name,
style: const TextStyle(
fontSize: 24,
)),
),
);
}).toList();

return DropdownButton<Currency>(
dropdownColor: GeniusWalletColors.containerGray,
borderRadius: BorderRadius.circular(GeniusWalletConsts.borderRadiusCard),
underline: const SizedBox(),
icon: Image.asset(
'assets/images/maskcurrencyselector.png',
package: 'genius_wallet',
),
icon: const Icon(Icons.arrow_drop_down),
items: items,
onChanged: (currency) => onChanged(currency!),
value: value,
hint: const Text(
'Select a Currency',
style: TextStyle(
fontSize: 30,
fontSize: 24,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/app/widgets/overlay/mobile_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MobileOverlay extends StatelessWidget {
Container(
padding: const EdgeInsets.symmetric(
horizontal: GeniusWalletConsts.horizontalPadding),
height: 40,
height: 55,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return GeniusAppbar(constraints);
Expand Down
160 changes: 79 additions & 81 deletions lib/calculator/view/calculator_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:genius_wallet/calculator/bloc/calculator_bloc.dart';
import 'package:genius_wallet/calculator/bloc/calculator_event.dart';
import 'package:genius_wallet/calculator/bloc/calculator_state.dart';
import 'package:genius_wallet/calculator/widgets/desktop_calculator.dart';
import 'package:genius_wallet/theme/genius_wallet_colors.g.dart';
import 'package:genius_wallet/widgets/components/back_button_header.g.dart';
import 'package:genius_wallet/widgets/components/coin_stats_card.g.dart';
import 'package:genius_wallet/widgets/components/conversion_result.g.dart';
Expand All @@ -21,6 +22,7 @@ class CalculatorScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: GeniusWalletColors.deepBlueTertiary,
body: BlocProvider(
create: (context) => CalculatorBloc(
geniusApi: context.read<GeniusApi>(),
Expand Down Expand Up @@ -84,86 +86,82 @@ class _CalculatorView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppScreenView(
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Column(
children: [
SizedBox(
height: 50,
child: LayoutBuilder(
builder: (context, constraints) {
return BackButtonHeader(
constraints,
ovrTitle: '',
);
},
),
),
SizedBox(
height: 30,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Header(
constraints,
ovrHeaderName: 'Calculator',
);
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 120,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return ModeFrom(constraints);
},
),
),
SizedBox(
height: 120,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return ModeTo(constraints);
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 120,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return EnterAmount(constraints);
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 115,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return BlocBuilder<CalculatorBloc, CalculatorState>(
builder: (context, state) {
if (state.getResultStatus == CalculatorStatus.loading) {
return const Center(child: CircularProgressIndicator());
}
if (state.conversionResult.isNotEmpty) {
return ConversionResult(
constraints,
ovrAmountentered: state.amountToConvert,
ovrResult:
'${state.currencyFrom!.symbol} = ${state.conversionResult} ${state.currencyTo!.symbol}',
);
}
return const SizedBox();
body: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 20, right: 20),
child: Column(children: [
SizedBox(
height: 30,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints constraints) {
return Header(
constraints,
ovrHeaderName: 'Calculator',
);
},
);
},
),
),
const SizedBox(height: 20),
const CoinsOverview(),
],
),
),
),
const SizedBox(height: 30),
SizedBox(
height: 120,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints constraints) {
return ModeFrom(constraints);
},
),
),
SizedBox(
height: 120,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints constraints) {
return ModeTo(constraints);
},
),
),
SizedBox(
height: 120,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints constraints) {
return EnterAmount(constraints);
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 115,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints constraints) {
return BlocBuilder<CalculatorBloc, CalculatorState>(
builder: (context, state) {
if (state.getResultStatus ==
CalculatorStatus.loading) {
return const Center(
child: CircularProgressIndicator());
}
if (state.conversionResult.isNotEmpty) {
return ConversionResult(
constraints,
ovrAmountentered: state.amountToConvert,
ovrResult:
'${state.currencyFrom!.symbol} = ${state.conversionResult} ${state.currencyTo!.symbol}',
);
}
return const SizedBox();
},
);
},
),
),
const SizedBox(height: 20),
const CoinsOverview(),
]))
],
),
);
}
Expand All @@ -180,7 +178,7 @@ class CoinsOverview extends StatelessWidget {
return Column(
children: [
SizedBox(
height: 200,
height: 225,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return CoinStatsCard(
Expand All @@ -198,7 +196,7 @@ class CoinsOverview extends StatelessWidget {
),
const SizedBox(height: 20),
SizedBox(
height: 200,
height: 225,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return CoinStatsCard(
Expand Down
Loading

0 comments on commit 9aece34

Please sign in to comment.