handleFileInit method
dynamic
handleFileInit(
- FileIDE file
)
Implementation
handleFileInit(FileIDE file) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String fileContent = file.content;
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
handleRegionFields(file);
if (file.hasRegion) {
int regionStart = file.region.start!;
if (prefs.get(file.id) != null) {
regionStart =
int.parse(prefs.getString(file.id)?.split(':')[0] ?? '');
}
if (file.content.split('\n').length > 7) {
Future.delayed(const Duration(milliseconds: 250), () {
double offset = fileContent
.split('\n')
.sublist(0, regionStart - 1 < 0 ? 0 : regionStart - 1)
.length *
getTextHeight(context);
scrollController.animateTo(
offset,
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut,
);
});
}
}
if (scrollController.hasClients && linebarController.hasClients) {
linebarController.jumpTo(0);
scrollController.jumpTo(0);
}
isLoading = false;
});
TextEditingControllerIDE.language = widget.language;
}