60 lines
1.8 KiB
Dart
60 lines
1.8 KiB
Dart
|
|
import 'package:hub/commons/actions/api_manager.dart';
|
|
import 'package:hub/modals/filters/options/widget.dart';
|
|
|
|
import '/commons/widgets/flutter_flow_util.dart';
|
|
import '/commons/widgets/request_manager.dart';
|
|
|
|
import 'widget.dart' show AcessHistoryPageWidget;
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
|
final unfocusNode = FocusNode();
|
|
final _accessHistoryManager = StreamRequestManager<ApiCallResponse>();
|
|
Stream<ApiCallResponse> accessHistory({
|
|
String? uniqueQueryKey,
|
|
bool? overrideCache,
|
|
required Stream<ApiCallResponse> Function() requestFn,
|
|
}) =>
|
|
_accessHistoryManager.performRequest(
|
|
uniqueQueryKey: uniqueQueryKey,
|
|
overrideCache: overrideCache,
|
|
requestFn: requestFn,
|
|
);
|
|
void clearAccessHistoryCache() => _accessHistoryManager.clear();
|
|
void clearAccessHistoryCacheKey(String? uniqueKey) =>
|
|
_accessHistoryManager.clearRequest(uniqueKey);
|
|
|
|
@override
|
|
void initState(BuildContext context) {}
|
|
|
|
@override
|
|
void dispose() {
|
|
unfocusNode.dispose();
|
|
|
|
/// Dispose query cache managers for this widget.
|
|
|
|
clearAccessHistoryCache();
|
|
}
|
|
|
|
Future toggleOptionsAction(BuildContext context) async {
|
|
await showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
useSafeArea: true,
|
|
context: context,
|
|
builder: (context) {
|
|
return GestureDetector(
|
|
onTap: () => unfocusNode.canRequestFocus
|
|
? FocusScope.of(context).requestFocus(unfocusNode)
|
|
: FocusScope.of(context).unfocus(),
|
|
child: Padding(
|
|
padding: MediaQuery.viewInsetsOf(context),
|
|
child: const OptModalWidget(),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|