2020-01-04 19:31:52 +00:00
|
|
|
import 'dart:ui';
|
2020-05-12 17:46:42 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:cake_wallet/palette.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
2020-05-14 17:29:10 +00:00
|
|
|
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
|
2020-05-18 17:23:33 +00:00
|
|
|
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/exchange/widgets/base_exchange_widget.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
class ExchangePage extends BasePage {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String get title => S.current.exchange;
|
|
|
|
|
|
|
|
@override
|
2020-05-12 17:46:42 +00:00
|
|
|
Color get backgroundColor => PaletteDark.walletCardSubAddressField;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget middle(BuildContext context) {
|
|
|
|
final exchangeStore = Provider.of<ExchangeStore>(context);
|
|
|
|
|
2020-05-18 17:23:33 +00:00
|
|
|
return PresentProviderPicker(exchangeStore: exchangeStore);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget trailing(BuildContext context) {
|
|
|
|
final exchangeStore = Provider.of<ExchangeStore>(context);
|
|
|
|
|
|
|
|
return ButtonTheme(
|
|
|
|
minWidth: double.minPositive,
|
2020-05-12 17:46:42 +00:00
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
splashColor: Colors.transparent,
|
2020-01-04 19:31:52 +00:00
|
|
|
child: FlatButton(
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).clear,
|
|
|
|
style: TextStyle(
|
2020-05-12 17:46:42 +00:00
|
|
|
color: PaletteDark.walletCardText,
|
2020-01-04 19:31:52 +00:00
|
|
|
fontWeight: FontWeight.w500,
|
2020-05-12 17:46:42 +00:00
|
|
|
fontSize: 14),
|
2020-01-04 19:31:52 +00:00
|
|
|
),
|
|
|
|
onPressed: () => exchangeStore.reset()),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget body(BuildContext context) => ExchangeForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
class ExchangeForm extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => ExchangeFormState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class ExchangeFormState extends State<ExchangeForm> {
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final exchangeStore = Provider.of<ExchangeStore>(context);
|
|
|
|
final walletStore = Provider.of<WalletStore>(context);
|
2020-05-14 17:29:10 +00:00
|
|
|
final exchangeTemplateStore = Provider.of<ExchangeTemplateStore>(context);
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-05-18 17:23:33 +00:00
|
|
|
return BaseExchangeWidget(
|
|
|
|
exchangeStore: exchangeStore,
|
|
|
|
walletStore: walletStore,
|
|
|
|
exchangeTemplateStore: exchangeTemplateStore,
|
|
|
|
isTemplate: false
|
2020-05-12 17:46:42 +00:00
|
|
|
);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
}
|