This commit is contained in:
Hillel Coren 2021-05-04 22:57:50 +03:00
parent 9ea3ab5e84
commit 6750c6846c
4 changed files with 41 additions and 14 deletions

View File

@ -140,6 +140,21 @@ class _DashboardScreenState extends State<DashboardScreen>
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final company = state.company;
Widget leading = SizedBox();
if (isMobile(context) || state.prefState.isMenuFloated) {
leading = Builder(
builder: (context) => InkWell(
child: IconButton(
tooltip: localization.menuSidebar,
icon: Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
),
),
);
}
final mainScaffold = Scaffold(
drawer: isMobile(context) || state.prefState.isMenuFloated
@ -150,9 +165,8 @@ class _DashboardScreenState extends State<DashboardScreen>
: null,
appBar: AppBar(
centerTitle: false,
leading: isMobile(context) || state.prefState.isMenuFloated
? null
: SizedBox(),
automaticallyImplyLeading: false,
leading: leading,
title: ListFilter(
key: ValueKey('__cleared_at_${state.uiState.filterClearedAt}__'),
entityType: EntityType.dashboard,

View File

@ -50,6 +50,22 @@ class ReportsScreen extends StatelessWidget {
final reportsState = viewModel.reportState;
final reportResult = viewModel.reportResult;
Widget leading = SizedBox();
if (isMobile(context) || state.prefState.isMenuFloated) {
leading = Builder(
builder: (context) => InkWell(
child: IconButton(
tooltip: localization.menuSidebar,
icon: Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
),
),
);
}
final hasCustomDate = reportsState.filters.keys.where((column) {
final filter = reportsState.filters[column];
return (getReportColumnType(column, context) ==
@ -195,8 +211,8 @@ class ReportsScreen extends StatelessWidget {
: null,
appBar: AppBar(
centerTitle: false,
automaticallyImplyLeading:
isMobile(context) || state.prefState.isMenuFloated,
automaticallyImplyLeading: false,
leading: leading,
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[

View File

@ -51,7 +51,7 @@ void main() {
});
test('Logout from a logged in user', () async {
await logout(driver, localization, fromDashboard: true);
await logout(driver, localization);
});
});
});

View File

@ -8,7 +8,6 @@ import 'package:invoiceninja_flutter/constants.dart';
import 'localizations.dart';
class Keys {
static const String openAppDrawer = 'Open navigation menu';
static const String clientPickerEmptyKey = '__client___';
static const String invoiceLineItemBaseKey = '__line_item';
}
@ -71,12 +70,9 @@ Future<void> login(FlutterDriver driver,
}
}
Future<void> logout(FlutterDriver driver, TestLocalization localization,
{bool fromDashboard = false}) async {
Future<void> logout(FlutterDriver driver, TestLocalization localization) async {
if (await isMobile(driver)) {
await driver.tap(fromDashboard
? find.byTooltip(Keys.openAppDrawer)
: find.byTooltip(localization.menuSidebar));
await driver.tap(find.byTooltip(localization.menuSidebar));
}
//await driver.scrollUntilVisible(find.byType('Drawer'), find.text(localization.settings));
@ -96,9 +92,10 @@ Future<void> logout(FlutterDriver driver, TestLocalization localization,
await driver.waitFor(find.text(localization.selfhosted.toUpperCase()));
}
Future<void> viewSection({FlutterDriver driver, String name}) async {
Future<void> viewSection(
{FlutterDriver driver, String name, TestLocalization localization}) async {
if (await isMobile(driver)) {
await driver.tap(find.byTooltip(Keys.openAppDrawer));
await driver.tap(find.byTooltip('Menu Sidebar'));
}
await driver.tap(find.byValueKey('menu_' + name));