Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Oct 24, 2023
2 parents 6388977 + 2815314 commit c3937a6
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 81 deletions.
6 changes: 2 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.22'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
Expand All @@ -22,11 +22,9 @@ allprojects {
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/build.gradle.foss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.22'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
Expand Down
2 changes: 2 additions & 0 deletions lib/redux/dashboard/dashboard_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ abstract class DashboardUISettings
static const String FIELD_ACTIVE_QUOTES = 'total_active_quotes';
static const String FIELD_APPROVED_QUOTES = 'total_approved_quotes';
static const String FIELD_UNAPPROVED_QUOTES = 'total_unapproved_quotes';
static const String FIELD_INVOICED_QUOTES = 'total_invoiced_quotes';
static const String FIELD_INVOICE_PAID_QUOTES = 'total_invoice_paid_quotes';
static const String FIELD_LOGGED_TASKS = 'total_logged_tasks';
static const String FIELD_INVOICED_TASKS = 'total_invoiced_tasks';
static const String FIELD_PAID_TASKS = 'total_paid_tasks';
Expand Down
167 changes: 93 additions & 74 deletions lib/ui/dashboard/dashboard_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ class DashboardChart extends StatefulWidget {
class _DashboardChartState extends State<DashboardChart> {
String? _selected;
int _selectedIndex = 0;
late ScrollController _controller;

@override
void initState() {
super.initState();

_controller = ScrollController();
}

@override
void dispose() {
_controller.dispose();

super.dispose();
}

void _onSelectionChanged(charts.SelectionModel model) {
if (widget.onDateSelected == null) {
Expand Down Expand Up @@ -139,82 +154,86 @@ class _DashboardChartState extends State<DashboardChart> {
Divider(height: 1.0),
LimitedBox(
maxHeight: settings.enableComparison ? 122 : 102,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: widget.data!.map((dataGroup) {
final int index = widget.data!.indexOf(dataGroup);
final bool isSelected = index == _selectedIndex;
final bool isIncrease =
dataGroup.periodTotal > dataGroup.previousTotal;
final String changeAmount = (isIncrease ? '+' : '') +
formatNumber(
dataGroup.periodTotal - dataGroup.previousTotal,
context,
currencyId: widget.currencyId)!;
final changePercent = (isIncrease ? '+' : '') +
formatNumber(
dataGroup.periodTotal != 0 &&
dataGroup.previousTotal != 0
? round(
(dataGroup.periodTotal -
dataGroup.previousTotal) /
dataGroup.previousTotal *
100,
2)
: 0.0,
context,
formatNumberType: FormatNumberType.percent,
currencyId: widget.currencyId)!;
final String changeString = dataGroup.periodTotal == 0 ||
dataGroup.previousTotal == 0 ||
dataGroup.periodTotal == dataGroup.previousTotal
? (settings.enableComparison ? ' ' : '')
: '$changeAmount ($changePercent)';
child: Scrollbar(
controller: _controller,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
controller: _controller,
children: widget.data!.map((dataGroup) {
final int index = widget.data!.indexOf(dataGroup);
final bool isSelected = index == _selectedIndex;
final bool isIncrease =
dataGroup.periodTotal > dataGroup.previousTotal;
final String changeAmount = (isIncrease ? '+' : '') +
formatNumber(
dataGroup.periodTotal - dataGroup.previousTotal,
context,
currencyId: widget.currencyId)!;
final changePercent = (isIncrease ? '+' : '') +
formatNumber(
dataGroup.periodTotal != 0 &&
dataGroup.previousTotal != 0
? round(
(dataGroup.periodTotal -
dataGroup.previousTotal) /
dataGroup.previousTotal *
100,
2)
: 0.0,
context,
formatNumberType: FormatNumberType.percent,
currencyId: widget.currencyId)!;
final String changeString = dataGroup.periodTotal == 0 ||
dataGroup.previousTotal == 0 ||
dataGroup.periodTotal == dataGroup.previousTotal
? (settings.enableComparison ? ' ' : '')
: '$changeAmount ($changePercent)';

return InkWell(
onTap: () {
setState(() {
_selectedIndex = index;
_selected = null;
});
},
child: Container(
color: isSelected ? state.accentColor : theme.cardColor,
padding: EdgeInsets.only(
left: 16, top: 16, right: 32, bottom: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(localization!.lookup(dataGroup.name),
style: theme.textTheme.titleLarge!.copyWith(
color: isSelected ? Colors.white : null,
)),
SizedBox(height: 4),
Text(
formatNumber(dataGroup.periodTotal, context,
currencyId: widget.currencyId)!,
style: theme.textTheme.headlineSmall!.copyWith(
color: isSelected ? Colors.white : null)),
SizedBox(height: 4),
changeString.isNotEmpty
? Text(
changeString,
style: TextStyle(
fontSize: 16,
color: isSelected
? Colors.white
: (isIncrease
? Colors.green
: Colors.red),
),
)
: SizedBox(),
],
return InkWell(
onTap: () {
setState(() {
_selectedIndex = index;
_selected = null;
});
},
child: Container(
color: isSelected ? state.accentColor : theme.cardColor,
padding: EdgeInsets.only(
left: 16, top: 16, right: 32, bottom: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(localization!.lookup(dataGroup.name),
style: theme.textTheme.titleLarge!.copyWith(
color: isSelected ? Colors.white : null,
)),
SizedBox(height: 4),
Text(
formatNumber(dataGroup.periodTotal, context,
currencyId: widget.currencyId)!,
style: theme.textTheme.headlineSmall!.copyWith(
color: isSelected ? Colors.white : null)),
SizedBox(height: 4),
changeString.isNotEmpty
? Text(
changeString,
style: TextStyle(
fontSize: 16,
color: isSelected
? Colors.white
: (isIncrease
? Colors.green
: Colors.red),
),
)
: SizedBox(),
],
),
),
),
);
}).toList(),
);
}).toList(),
),
),
),
Divider(height: 1.0),
Expand Down
8 changes: 8 additions & 0 deletions lib/ui/dashboard/dashboard_panels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ class DashboardPanels extends StatelessWidget {
currentQuoteData[1],
DashboardUISettings.FIELD_UNAPPROVED_QUOTES:
currentQuoteData[2],
DashboardUISettings.FIELD_INVOICED_QUOTES:
currentQuoteData[3],
DashboardUISettings.FIELD_INVOICE_PAID_QUOTES:
currentQuoteData[4],
DashboardUISettings.FIELD_LOGGED_TASKS: currentTaskData[0],
DashboardUISettings.FIELD_INVOICED_TASKS:
currentTaskData[1],
Expand Down Expand Up @@ -587,6 +591,10 @@ class DashboardPanels extends StatelessWidget {
previousQuoteData[1],
DashboardUISettings.FIELD_UNAPPROVED_QUOTES:
previousQuoteData[2],
DashboardUISettings.FIELD_INVOICED_QUOTES:
previousQuoteData[3],
DashboardUISettings.FIELD_INVOICE_PAID_QUOTES:
previousQuoteData[4],
DashboardUISettings.FIELD_LOGGED_TASKS: currentTaskData[0],
DashboardUISettings.FIELD_INVOICED_TASKS:
previousTaskData[1],
Expand Down
15 changes: 13 additions & 2 deletions lib/utils/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'directory_does_not_exist':
'total_invoiced_quotes': 'Invoiced Quotes',
'total_invoice_paid_quotes': 'Invoice Paid Quotes',
'directory_does_not_exist':
'The download directory does not exist :value',
'user_logged_in_notification': 'User Logged in Notification',
'user_logged_in_notification_help':
Expand Down Expand Up @@ -109904,7 +109906,16 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['directory_does_not_exist'] ??
_localizedValues['en']!['directory_does_not_exist']!;

// STARTER: lang field - do not remove comment
String get totalInvoicedQuotes =>
_localizedValues[localeCode]!['total_invoiced_quotes'] ??
_localizedValues['en']!['total_invoiced_quotes']!;

String get totalInvoicePaidQuotes =>
_localizedValues[localeCode]!['total_invoice_paid_quotes'] ??
_localizedValues['en']!['total_invoice_paid_quotes']!;


// STARTER: lang field - do not remove comment

String lookup(String? key) {
final lookupKey = toSnakeCase(key);
Expand Down

0 comments on commit c3937a6

Please sign in to comment.