Skip to content

Commit d04440c

Browse files
authored
[Gallery] Update desktop Rally for pages that did not have designs before (#314)
* Update desktop Rally for pages that did not have designs before
1 parent c1acfe7 commit d04440c

15 files changed

+1118
-807
lines changed
299 KB
Binary file not shown.
310 KB
Binary file not shown.

gallery/lib/l10n/gallery_localizations.dart

Lines changed: 740 additions & 661 deletions
Large diffs are not rendered by default.

gallery/lib/l10n/intl_en_US.arb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@
171171
"@rallyAccountDetailDataAccountOwner": {
172172
"description": "Title for an account detail. Below the name of the account owner will be displayed."
173173
},
174+
"rallyBillDetailTotalAmount": "Total Amount",
175+
"@rallyBillDetailTotalAmount": {
176+
"description": "Title for column where it displays the total dollar amount that the user has in bills."
177+
},
178+
"rallyBillDetailAmountPaid": "Amount Paid",
179+
"@rallyBillDetailAmountPaid": {
180+
"description": "Title for column where it displays the amount that the user has paid."
181+
},
182+
"rallyBillDetailAmountDue": "Amount Due",
183+
"@rallyBillDetailAmountDue": {
184+
"description": "Title for column where it displays the amount that the user has due."
185+
},
174186
"rallyBudgetCategoryCoffeeShops": "Coffee Shops",
175187
"@rallyBudgetCategoryCoffeeShops": {
176188
"description": "Category for budget, to sort expenses / bills in."
@@ -187,6 +199,18 @@
187199
"@rallyBudgetCategoryClothing": {
188200
"description": "Category for budget, to sort expenses / bills in."
189201
},
202+
"rallyBudgetDetailTotalCap": "Total Cap",
203+
"@rallyBudgetDetailTotalCap": {
204+
"description": "Title for column where it displays the total dollar cap that the user has for its budget."
205+
},
206+
"rallyBudgetDetailAmountUsed": "Amount Used",
207+
"@rallyBudgetDetailAmountUsed": {
208+
"description": "Title for column where it displays the dollar amount that the user has used in its budget."
209+
},
210+
"rallyBudgetDetailAmountLeft": "Amount Left",
211+
"@rallyBudgetDetailAmountLeft": {
212+
"description": "Title for column where it displays the dollar amount that the user has left in its budget."
213+
},
190214
"rallySettingsManageAccounts": "Manage Accounts",
191215
"@rallySettingsManageAccounts": {
192216
"description": "Link to go to the page 'Manage Accounts."

gallery/lib/l10n/intl_en_US.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@
161161
name="rallyAccountDetailDataAccountOwner"
162162
description="Title for an account detail. Below the name of the account owner will be displayed."
163163
>Account Owner</string>
164+
<string
165+
name="rallyBillDetailTotalAmount"
166+
description="Title for column where it displays the total dollar amount that the user has in bills."
167+
>Total Amount</string>
168+
<string
169+
name="rallyBillDetailAmountPaid"
170+
description="Title for column where it displays the amount that the user has paid."
171+
>Amount Paid</string>
172+
<string
173+
name="rallyBillDetailAmountDue"
174+
description="Title for column where it displays the amount that the user has due."
175+
>Amount Due</string>
164176
<string
165177
name="rallyBudgetCategoryCoffeeShops"
166178
description="Category for budget, to sort expenses / bills in."
@@ -177,6 +189,18 @@
177189
name="rallyBudgetCategoryClothing"
178190
description="Category for budget, to sort expenses / bills in."
179191
>Clothing</string>
192+
<string
193+
name="rallyBudgetDetailTotalCap"
194+
description="Title for column where it displays the total dollar cap that the user has for its budget."
195+
>Total Cap</string>
196+
<string
197+
name="rallyBudgetDetailAmountUsed"
198+
description="Title for column where it displays the dollar amount that the user has used in its budget."
199+
>Amount Used</string>
200+
<string
201+
name="rallyBudgetDetailAmountLeft"
202+
description="Title for column where it displays the dollar amount that the user has left in its budget."
203+
>Amount Left</string>
180204
<string
181205
name="rallySettingsManageAccounts"
182206
description="Link to go to the page &apos;Manage Accounts."

gallery/lib/l10n/messages_en_US.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,12 @@ class MessageLookup extends MessageLookupByLibrary {
995995
"rallyAlertsMessageSpentOnRestaurants": m24,
996996
"rallyAlertsMessageUnassignedTransactions": m25,
997997
"rallyBillAmount": m26,
998+
"rallyBillDetailAmountDue":
999+
MessageLookupByLibrary.simpleMessage("Amount Due"),
1000+
"rallyBillDetailAmountPaid":
1001+
MessageLookupByLibrary.simpleMessage("Amount Paid"),
1002+
"rallyBillDetailTotalAmount":
1003+
MessageLookupByLibrary.simpleMessage("Total Amount"),
9981004
"rallyBills": MessageLookupByLibrary.simpleMessage("Bills"),
9991005
"rallyBillsDue": MessageLookupByLibrary.simpleMessage("Due"),
10001006
"rallyBudgetAmount": m27,
@@ -1006,6 +1012,12 @@ class MessageLookup extends MessageLookupByLibrary {
10061012
MessageLookupByLibrary.simpleMessage("Groceries"),
10071013
"rallyBudgetCategoryRestaurants":
10081014
MessageLookupByLibrary.simpleMessage("Restaurants"),
1015+
"rallyBudgetDetailAmountLeft":
1016+
MessageLookupByLibrary.simpleMessage("Amount Left"),
1017+
"rallyBudgetDetailAmountUsed":
1018+
MessageLookupByLibrary.simpleMessage("Amount Used"),
1019+
"rallyBudgetDetailTotalCap":
1020+
MessageLookupByLibrary.simpleMessage("Total Cap"),
10091021
"rallyBudgetLeft": MessageLookupByLibrary.simpleMessage("Left"),
10101022
"rallyBudgets": MessageLookupByLibrary.simpleMessage("Budgets"),
10111023
"rallyDescription":

gallery/lib/studies/rally/charts/line_chart.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:flutter/semantics.dart';
88

99
import 'package:gallery/data/gallery_options.dart';
1010
import 'package:gallery/layout/text_scale.dart';
11+
import 'package:gallery/layout/adaptive.dart';
1112
import 'package:gallery/studies/rally/colors.dart';
1213
import 'package:gallery/studies/rally/data.dart';
1314
import 'package:gallery/studies/rally/formatters.dart';
@@ -28,6 +29,9 @@ class RallyLineChart extends StatelessWidget {
2829
labelStyle: Theme.of(context).textTheme.body1,
2930
textDirection: GalleryOptions.of(context).textDirection(),
3031
textScaleFactor: reducedTextScale(context),
32+
padding: isDisplayDesktop(context)
33+
? EdgeInsets.symmetric(vertical: 22)
34+
: EdgeInsets.zero,
3135
),
3236
);
3337
}
@@ -41,6 +45,7 @@ class RallyLineChartPainter extends CustomPainter {
4145
@required this.labelStyle,
4246
@required this.textDirection,
4347
@required this.textScaleFactor,
48+
@required this.padding,
4449
});
4550

4651
// The style for the labels.
@@ -52,6 +57,9 @@ class RallyLineChartPainter extends CustomPainter {
5257
// The text scale factor for the text.
5358
final double textScaleFactor;
5459

60+
// The padding around the text.
61+
final EdgeInsets padding;
62+
5563
// The format for the dates.
5664
final intl.DateFormat dateFormat;
5765

@@ -253,7 +261,8 @@ class RallyLineChartPainter extends CustomPainter {
253261
textDirection: textDirection,
254262
);
255263
leftLabel.layout();
256-
leftLabel.paint(canvas, Offset(rect.left + space / 2, rect.topCenter.dy));
264+
leftLabel.paint(canvas,
265+
Offset(rect.left + space / 2 + padding.vertical, rect.topCenter.dy));
257266

258267
final centerLabel = TextPainter(
259268
text: TextSpan(
@@ -281,7 +290,8 @@ class RallyLineChartPainter extends CustomPainter {
281290
rightLabel.layout();
282291
rightLabel.paint(
283292
canvas,
284-
Offset(rect.right - centerLabel.width - space / 2, rect.topCenter.dy),
293+
Offset(rect.right - centerLabel.width - space / 2 - padding.vertical,
294+
rect.topCenter.dy),
285295
);
286296
}
287297
}

gallery/lib/studies/rally/colors.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class RallyColors {
3838
static const Color cardBackground = Color(0x03FEFEFE);
3939
static const Color buttonColor = Color(0xFF09AF79);
4040
static const Color focusColor = Color(0xCCFFFFFF);
41+
static const Color dividerColor = Color(0xAA282828);
4142

4243
/// Convenience method to get a single account color with position i.
4344
static Color accountColor(int i) {

gallery/lib/studies/rally/data.dart

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ double sumAccountDataPrimaryAmount(List<AccountData> items) =>
1515
double sumBillDataPrimaryAmount(List<BillData> items) =>
1616
sumOf<BillData>(items, (item) => item.primaryAmount);
1717

18+
/// Calculates the sum of the primary amounts of a list of [BillData].
19+
double sumBillDataPaidAmount(List<BillData> items) => sumOf<BillData>(
20+
items.where((item) => item.isPaid).toList(),
21+
(item) => item.primaryAmount,
22+
);
23+
1824
/// Calculates the sum of the primary amounts of a list of [BudgetData].
1925
double sumBudgetDataPrimaryAmount(List<BudgetData> items) =>
2026
sumOf<BudgetData>(items, (item) => item.primaryAmount);
@@ -52,7 +58,12 @@ class AccountData {
5258
///
5359
/// The [primaryAmount] is the amount due in USD.
5460
class BillData {
55-
const BillData({this.name, this.primaryAmount, this.dueDate});
61+
const BillData({
62+
this.name,
63+
this.primaryAmount,
64+
this.dueDate,
65+
this.isPaid = false,
66+
});
5667

5768
/// The display name of this entity.
5869
final String name;
@@ -62,6 +73,9 @@ class BillData {
6273

6374
/// The due date of this bill.
6475
final String dueDate;
76+
77+
/// If this bill has been paid.
78+
final bool isPaid;
6579
}
6680

6781
/// A data model for a budget.
@@ -103,9 +117,9 @@ class DetailedEventData {
103117
final double amount;
104118
}
105119

106-
/// A data model for account data.
107-
class AccountDetailData {
108-
AccountDetailData({this.title, this.value});
120+
/// A data model for data displayed to the user.
121+
class UserDetailData {
122+
UserDetailData({this.title, this.value});
109123

110124
/// The display name of this entity.
111125
final String title;
@@ -143,34 +157,34 @@ class DummyDataService {
143157
];
144158
}
145159

146-
static List<AccountDetailData> getAccountDetailList(BuildContext context) {
147-
return <AccountDetailData>[
148-
AccountDetailData(
160+
static List<UserDetailData> getAccountDetailList(BuildContext context) {
161+
return <UserDetailData>[
162+
UserDetailData(
149163
title: GalleryLocalizations.of(context)
150164
.rallyAccountDetailDataAnnualPercentageYield,
151165
value: percentFormat(context).format(0.001),
152166
),
153-
AccountDetailData(
167+
UserDetailData(
154168
title:
155169
GalleryLocalizations.of(context).rallyAccountDetailDataInterestRate,
156170
value: usdWithSignFormat(context).format(1676.14),
157171
),
158-
AccountDetailData(
172+
UserDetailData(
159173
title:
160174
GalleryLocalizations.of(context).rallyAccountDetailDataInterestYtd,
161175
value: usdWithSignFormat(context).format(81.45),
162176
),
163-
AccountDetailData(
177+
UserDetailData(
164178
title: GalleryLocalizations.of(context)
165179
.rallyAccountDetailDataInterestPaidLastYear,
166180
value: usdWithSignFormat(context).format(987.12),
167181
),
168-
AccountDetailData(
182+
UserDetailData(
169183
title: GalleryLocalizations.of(context)
170184
.rallyAccountDetailDataNextStatement,
171185
value: shortDateFormat(context).format(DateTime.utc(2019, 12, 25)),
172186
),
173-
AccountDetailData(
187+
UserDetailData(
174188
title:
175189
GalleryLocalizations.of(context).rallyAccountDetailDataAccountOwner,
176190
value: 'Philip Cao',
@@ -233,6 +247,7 @@ class DummyDataService {
233247
primaryAmount: 1200,
234248
dueDate: dateFormatAbbreviatedMonthDay(context)
235249
.format(DateTime.utc(2019, 2, 9)),
250+
isPaid: true,
236251
),
237252
BillData(
238253
name: 'TabFine Credit',
@@ -249,6 +264,24 @@ class DummyDataService {
249264
];
250265
}
251266

267+
static List<UserDetailData> getBillDetailList(BuildContext context,
268+
{double dueTotal, double paidTotal}) {
269+
return <UserDetailData>[
270+
UserDetailData(
271+
title: GalleryLocalizations.of(context).rallyBillDetailTotalAmount,
272+
value: usdWithSignFormat(context).format(paidTotal + dueTotal),
273+
),
274+
UserDetailData(
275+
title: GalleryLocalizations.of(context).rallyBillDetailAmountPaid,
276+
value: usdWithSignFormat(context).format(paidTotal),
277+
),
278+
UserDetailData(
279+
title: GalleryLocalizations.of(context).rallyBillDetailAmountDue,
280+
value: usdWithSignFormat(context).format(dueTotal),
281+
),
282+
];
283+
}
284+
252285
static List<BudgetData> getBudgetDataList(BuildContext context) {
253286
return <BudgetData>[
254287
BudgetData(
@@ -274,6 +307,24 @@ class DummyDataService {
274307
];
275308
}
276309

310+
static List<UserDetailData> getBudgetDetailList(BuildContext context,
311+
{double capTotal, double usedTotal}) {
312+
return <UserDetailData>[
313+
UserDetailData(
314+
title: GalleryLocalizations.of(context).rallyBudgetDetailTotalCap,
315+
value: usdWithSignFormat(context).format(capTotal),
316+
),
317+
UserDetailData(
318+
title: GalleryLocalizations.of(context).rallyBudgetDetailAmountUsed,
319+
value: usdWithSignFormat(context).format(usedTotal),
320+
),
321+
UserDetailData(
322+
title: GalleryLocalizations.of(context).rallyBudgetDetailAmountLeft,
323+
value: usdWithSignFormat(context).format(capTotal - usedTotal),
324+
),
325+
];
326+
}
327+
277328
static List<String> getSettingsTitles(BuildContext context) {
278329
return <String>[
279330
GalleryLocalizations.of(context).rallySettingsManageAccounts,

0 commit comments

Comments
 (0)