Skip to content

Commit

Permalink
Merge pull request #1937 from get10101/chore/order-history-redesign
Browse files Browse the repository at this point in the history
chore: redesign webapp overview
  • Loading branch information
bonomat authored Feb 1, 2024
2 parents abcc314 + f32c781 commit be1e1f8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 98 deletions.
48 changes: 0 additions & 48 deletions webapp/frontend/lib/trade/order_and_position_table.dart

This file was deleted.

8 changes: 2 additions & 6 deletions webapp/frontend/lib/trade/order_history_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OrderHistoryTable extends StatelessWidget {
orders.sort((a, b) => b.creationTimestamp.compareTo(a.creationTimestamp));

return Table(
border: TableBorder.symmetric(inside: const BorderSide(width: 2, color: Colors.black)),
border: const TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.black)),
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: MinColumnWidth(FixedColumnWidth(100.0), FractionColumnWidth(0.1)),
Expand All @@ -50,11 +50,7 @@ class OrderHistoryTable extends StatelessWidget {
TableRow(
decoration: BoxDecoration(
color: tenTenOnePurple.shade300,
border: Border.all(
width: 1,
),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10)),
border: const Border(bottom: BorderSide(width: 0.5, color: Colors.black)),
),
children: [
buildHeaderCell('State'),
Expand Down
10 changes: 3 additions & 7 deletions webapp/frontend/lib/trade/position_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class OpenPositionTable extends StatelessWidget {

Widget buildTable(List<Position> positions, BestQuote? bestQuote, BuildContext context) {
return Table(
border: TableBorder.symmetric(inside: const BorderSide(width: 2, color: Colors.black)),
border: const TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.black)),
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: MinColumnWidth(FixedColumnWidth(100.0), FractionColumnWidth(0.1)),
Expand All @@ -50,11 +50,7 @@ class OpenPositionTable extends StatelessWidget {
TableRow(
decoration: BoxDecoration(
color: tenTenOnePurple.shade300,
border: Border.all(
width: 1,
),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10)),
border: const Border(bottom: BorderSide(width: 0.5, color: Colors.black)),
),
children: [
buildHeaderCell('Quantity'),
Expand Down Expand Up @@ -120,7 +116,7 @@ class OpenPositionTable extends StatelessWidget {
alignment: Alignment.center,
child: Text(text,
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.white))));
style: const TextStyle(fontWeight: FontWeight.normal, color: Colors.white))));
}

TableCell buildTableCell(Widget child) => TableCell(
Expand Down
96 changes: 59 additions & 37 deletions webapp/frontend/lib/trade/trade_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get_10101/common/color.dart';
import 'package:get_10101/trade/order_and_position_table.dart';
import 'package:get_10101/trade/order_history_table.dart';
import 'package:get_10101/trade/position_table.dart';
import 'package:get_10101/trade/trade_screen_order_form.dart';

class TradeScreen extends StatefulWidget {
Expand Down Expand Up @@ -65,6 +66,8 @@ class _TradeScreenState extends State<TradeScreen> with SingleTickerProviderStat
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Visibility(
visible: false,
Expand All @@ -84,20 +87,11 @@ class _TradeScreenState extends State<TradeScreen> with SingleTickerProviderStat
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.grey[100],
),
child: const Row(
children: [Expanded(child: OrderAndPositionTable())],
),
),
),
createTableWidget(const OpenPositionTable(), "Open Positions"),
const SizedBox(
height: 10,
),
createTableWidget(const OrderHistoryTable(), "Order History"),
],
),
),
Expand All @@ -106,6 +100,50 @@ class _TradeScreenState extends State<TradeScreen> with SingleTickerProviderStat
);
}

Expanded createTableWidget(Widget child, String title) {
return Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.grey[100],
),
child: Column(
children: [
Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
color: tenTenOnePurple.shade300,
border: Border.all(
width: 0.5,
),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10)),
),
padding: const EdgeInsets.all(10),
alignment: Alignment.center,
child: Text(title,
textAlign: TextAlign.center,
style:
const TextStyle(fontWeight: FontWeight.bold, color: Colors.white))),
),
],
),
Row(
children: [
Expanded(child: child),
],
),
],
),
),
),
);
}

Widget _buildHVerticalWidget(BoxConstraints constraints, BoxConstraints viewportConstraints) {
return Padding(
padding: const EdgeInsets.all(8.0),
Expand All @@ -126,30 +164,14 @@ class _TradeScreenState extends State<TradeScreen> with SingleTickerProviderStat
),
child: NewOrderWidget(tabController: _tabController),
),
Expanded(
child: Container(
height: 120.0,
alignment: Alignment.center,
child: Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 8),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.grey[100],
),
child: const Row(
children: [Expanded(child: OrderAndPositionTable())],
),
),
),
),
],
),
),
const SizedBox(
height: 10,
),
createTableWidget(const OpenPositionTable(), "Open Positions"),
const SizedBox(
height: 10,
),
createTableWidget(const OrderHistoryTable(), "Order History"),
],
),
))));
Expand Down

0 comments on commit be1e1f8

Please sign in to comment.