fix table
This commit is contained in:
parent
6fa45c8ac0
commit
97313371c3
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@ -35,13 +37,47 @@ class TablePage extends StatefulWidget implements AutoRouteWrapper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TablePageState extends State<TablePage> {
|
class _TablePageState extends State<TablePage>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
t.Table? draggingTable;
|
t.Table? draggingTable;
|
||||||
|
|
||||||
Offset? tapPosition;
|
Offset? tapPosition;
|
||||||
|
bool _isFirstBuild = true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
log('🔥 TablePage initState');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
// Cek apakah tab ini aktif
|
||||||
|
final route = ModalRoute.of(context);
|
||||||
|
if (route != null && route.isCurrent) {
|
||||||
|
if (!_isFirstBuild) {
|
||||||
|
log('🔥 TablePage visible again, refresh');
|
||||||
|
_refreshTable();
|
||||||
|
}
|
||||||
|
_isFirstBuild = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _refreshTable() {
|
||||||
|
if (mounted) {
|
||||||
|
context.read<TableLoaderBloc>().add(
|
||||||
|
const TableLoaderEvent.fetched(isRefresh: true),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
final double mapWidth = context.deviceWidth * 2;
|
final double mapWidth = context.deviceWidth * 2;
|
||||||
final double mapHeight = context.deviceHeight * 1.5;
|
final double mapHeight = context.deviceHeight * 1.5;
|
||||||
|
|
||||||
|
|||||||
@ -576,7 +576,7 @@ class TableRoute extends _i22.PageRouteInfo<void> {
|
|||||||
static _i22.PageInfo page = _i22.PageInfo(
|
static _i22.PageInfo page = _i22.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return _i22.WrappedRoute(child: const _i19.TablePage());
|
return const _i19.TablePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user