Remove app_scrollbar class
This commit is contained in:
parent
7614e81b59
commit
b7281abbf1
|
|
@ -1,42 +0,0 @@
|
|||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
|
||||
class AppScrollbar extends StatefulWidget {
|
||||
const AppScrollbar({
|
||||
@required this.child,
|
||||
@required this.controller,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final ScrollController controller;
|
||||
|
||||
@override
|
||||
_AppScrollbarState createState() => _AppScrollbarState();
|
||||
}
|
||||
|
||||
class _AppScrollbarState extends State<AppScrollbar> {
|
||||
bool _isHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isMobile(context)) {
|
||||
return Scrollbar(
|
||||
child: widget.child,
|
||||
controller: widget.controller,
|
||||
);
|
||||
} else {
|
||||
return MouseRegion(
|
||||
onEnter: (event) => setState(() => _isHovered = true),
|
||||
onExit: (event) => setState(() => _isHovered = false),
|
||||
child: Scrollbar(
|
||||
child: widget.child,
|
||||
controller: widget.controller,
|
||||
trackVisibility: isDesktop(context) && _isHovered,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:invoiceninja_flutter/ui/app/app_scrollbar.dart';
|
||||
|
||||
class ScrollableListView extends StatefulWidget {
|
||||
const ScrollableListView({
|
||||
Key key,
|
||||
|
|
@ -37,14 +34,11 @@ class _ScrollableListViewState extends State<ScrollableListView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScrollbar(
|
||||
return ListView(
|
||||
padding: widget.padding,
|
||||
children: widget.children,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
child: ListView(
|
||||
padding: widget.padding,
|
||||
children: widget.children,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
shrinkWrap: true,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,24 +81,21 @@ class _ScrollableListViewBuilderState extends State<ScrollableListViewBuilder> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScrollbar(
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
child: widget.separatorBuilder != null
|
||||
? ListView.separated(
|
||||
separatorBuilder: widget.separatorBuilder,
|
||||
padding: widget.padding,
|
||||
itemBuilder: widget.itemBuilder,
|
||||
itemCount: widget.itemCount,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
shrinkWrap: true,
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: widget.padding,
|
||||
itemBuilder: widget.itemBuilder,
|
||||
itemCount: widget.itemCount,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
shrinkWrap: true,
|
||||
),
|
||||
);
|
||||
return widget.separatorBuilder != null
|
||||
? ListView.separated(
|
||||
separatorBuilder: widget.separatorBuilder,
|
||||
padding: widget.padding,
|
||||
itemBuilder: widget.itemBuilder,
|
||||
itemCount: widget.itemCount,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
shrinkWrap: true,
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: widget.padding,
|
||||
itemBuilder: widget.itemBuilder,
|
||||
itemCount: widget.itemCount,
|
||||
controller: widget.scrollController ?? _scrollController,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_border.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_scrollbar.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/save_cancel_buttons.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/help_text.dart';
|
||||
|
|
@ -244,69 +243,65 @@ class _EntityListState extends State<EntityList> {
|
|||
},
|
||||
),
|
||||
Expanded(
|
||||
child: AppScrollbar(
|
||||
child: SingleChildScrollView(
|
||||
controller: _controller,
|
||||
child: SingleChildScrollView(
|
||||
controller: _controller,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: AppPaginatedDataTable(
|
||||
onSelectAll: (value) {
|
||||
final startIndex =
|
||||
min(_firstRowIndex, entityList.length - 1);
|
||||
final endIndex = min(
|
||||
_firstRowIndex + rowsPerPage, entityList.length);
|
||||
final entities = entityList
|
||||
.sublist(startIndex, endIndex)
|
||||
.map<BaseEntity>(
|
||||
(String entityId) => entityMap[entityId])
|
||||
.where((invoice) =>
|
||||
value != listUIState.isSelected(invoice.id))
|
||||
.toList();
|
||||
handleEntitiesActions(
|
||||
entities, EntityAction.toggleMultiselect);
|
||||
},
|
||||
columns: [
|
||||
if (!isInMultiselect) DataColumn(label: SizedBox()),
|
||||
...widget.tableColumns.map((field) {
|
||||
String label =
|
||||
AppLocalization.of(context).lookup(field);
|
||||
if (field.startsWith('custom')) {
|
||||
final key = field.replaceFirst(
|
||||
'custom', entityType.snakeCase);
|
||||
label = state.company.getCustomFieldLabel(key);
|
||||
}
|
||||
return DataColumn(
|
||||
label: Container(
|
||||
child: Text(
|
||||
label,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: AppPaginatedDataTable(
|
||||
onSelectAll: (value) {
|
||||
final startIndex =
|
||||
min(_firstRowIndex, entityList.length - 1);
|
||||
final endIndex =
|
||||
min(_firstRowIndex + rowsPerPage, entityList.length);
|
||||
final entities = entityList
|
||||
.sublist(startIndex, endIndex)
|
||||
.map<BaseEntity>(
|
||||
(String entityId) => entityMap[entityId])
|
||||
.where((invoice) =>
|
||||
value != listUIState.isSelected(invoice.id))
|
||||
.toList();
|
||||
handleEntitiesActions(
|
||||
entities, EntityAction.toggleMultiselect);
|
||||
},
|
||||
columns: [
|
||||
if (!isInMultiselect) DataColumn(label: SizedBox()),
|
||||
...widget.tableColumns.map((field) {
|
||||
String label =
|
||||
AppLocalization.of(context).lookup(field);
|
||||
if (field.startsWith('custom')) {
|
||||
final key = field.replaceFirst(
|
||||
'custom', entityType.snakeCase);
|
||||
label = state.company.getCustomFieldLabel(key);
|
||||
}
|
||||
return DataColumn(
|
||||
label: Container(
|
||||
child: Text(
|
||||
label,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onSort: (int columnIndex, bool ascending) {
|
||||
widget.onSortColumn(field);
|
||||
});
|
||||
}),
|
||||
],
|
||||
source: dataTableSource,
|
||||
sortColumnIndex: widget.tableColumns
|
||||
.contains(listUIState.sortField)
|
||||
? widget.tableColumns.indexOf(listUIState.sortField)
|
||||
: 0,
|
||||
sortAscending: listUIState.sortAscending,
|
||||
rowsPerPage: state.prefState.rowsPerPage,
|
||||
onPageChanged: (row) => _firstRowIndex = row,
|
||||
initialFirstRowIndex: _firstRowIndex,
|
||||
availableRowsPerPage: [
|
||||
10,
|
||||
25,
|
||||
50,
|
||||
],
|
||||
onRowsPerPageChanged: (value) {
|
||||
store.dispatch(
|
||||
UpdateUserPreferences(rowsPerPage: value));
|
||||
},
|
||||
),
|
||||
),
|
||||
onSort: (int columnIndex, bool ascending) {
|
||||
widget.onSortColumn(field);
|
||||
});
|
||||
}),
|
||||
],
|
||||
source: dataTableSource,
|
||||
sortColumnIndex:
|
||||
widget.tableColumns.contains(listUIState.sortField)
|
||||
? widget.tableColumns.indexOf(listUIState.sortField)
|
||||
: 0,
|
||||
sortAscending: listUIState.sortAscending,
|
||||
rowsPerPage: state.prefState.rowsPerPage,
|
||||
onPageChanged: (row) => _firstRowIndex = row,
|
||||
initialFirstRowIndex: _firstRowIndex,
|
||||
availableRowsPerPage: [
|
||||
10,
|
||||
25,
|
||||
50,
|
||||
],
|
||||
onRowsPerPageChanged: (value) {
|
||||
store.dispatch(UpdateUserPreferences(rowsPerPage: value));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue