In the past I successfully used version 0.08 in August of last year of this widget (https://pub.dev/packages/widget_screenshot). I cloned my repository today.
Now, with the same code (in physical and simulated devices, both version 0.08 and version 0.09) are generating error with the same tested code.
This error appeared only with large screen. I attached the screenshot of my installed version in my phone
Now this issues appear
E/flutter (12312): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 3356 pos 12: '!debugNeedsPaint': is not true.
E/flutter (12312): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter (12312): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter (12312): #2 RenderRepaintBoundary.toImage (package:flutter/src/rendering/proxy_box.dart:3356:12)
E/flutter (12312): #3 WidgetShotRenderRepaintBoundary._screenshot (package:widget_screenshot/src/widget_screenshot.dart:212:28)
E/flutter (12312): #4 WidgetShotRenderRepaintBoundary.screenshot (package:widget_screenshot/src/widget_screenshot.dart:73:28)
E/flutter (12312): #5 HomePageTopAppBar.build.<anonymous closure> (package:tmra/pages/home_page/home_page_widgets.dart:225:54)
E/flutter (12312): #6 _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1183:21)
E/flutter (12312): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
E/flutter (12312): #8 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11)
E/flutter (12312): #9 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309:5)
E/flutter (12312): #10 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:279:7)
E/flutter (12312): #11 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:167:27)
E/flutter (12312): #12 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:492:20)
E/flutter (12312): #13 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
E/flutter (12312): #14 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
E/flutter (12312): #15 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
E/flutter (12312): #16 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
E/flutter (12312): #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
E/flutter (12312): #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
E/flutter (12312): #19 _invoke1 (dart:ui/hooks.dart:328:13)
E/flutter (12312): #20 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:410:7)
E/flutter (12312): #21 _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
E/flutter (12312):
D/EGL_emulation(12312): app_time_stats: avg=9620.64ms min=12.61ms max=163282.84ms count=17
D/EGL_emulation(12312): app_time_stats: avg=76.62ms min=11.31ms max=1662.93ms count=29
PS D:\flutter_app\tmra> flutter --version
Flutter 3.16.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision db7ef5bf9f (6 weeks ago) • 2023-11-15 11:25:44 -0800
Engine • revision 74d16627b9
Tools • Dart 3.2.0 • DevTools 2.28.2
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/intl.dart';
import 'package:tmra/common.dart';
import 'package:tmra/constants.dart';
import 'package:tmra/models/model_sensors.dart';
import 'package:tmra/models/sensors_type.dart';
import 'package:tmra/pages/download_page/download_page.dart';
import 'package:tmra/pages/home_page/fill_sensors.dart';
import 'package:tmra/services/services_sensors.dart';
import 'package:widget_screenshot/widget_screenshot.dart';
import '../info_page/info_page.dart';
import 'home_page_widgets.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key, required this.wifiName, required this.testMode})
: super(key: key);
@override
State<HomePage> createState() => _HomePageState();
final String wifiName;
final bool testMode;
}
class _HomePageState extends State<HomePage> {
List<SensorType> sensors = [];
Sensors info = Sensors();
var services = SensorsTMRAServices();
String timeStampUtc="";
String timeDownload = '';
late PageController _pageController;
///Para captura de pantalla
GlobalKey headerEMKey = GlobalKey();
GlobalKey sensorsEMKey = GlobalKey();
ScrollController scrollController = ScrollController();
void getSensorInfo() async {
info = await services.getSensorsValues(widget.testMode);
sensors = fillSensor(info);
///Quitar UTC (+3 horas)
timeStampUtc = subtractUTC(info.timeStampUtc!, 3);
timeDownload = subtractUTC(info.timeDownloadUtc!, 3);
setState(() {});
}
@override
void initState() {
getSensorInfo();
_pageController = PageController(viewportFraction: 1, keepPage: true);
super.initState();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
double widthScreen = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.black,
extendBody: true,
body: Stack(
alignment: Alignment.center,
children: [
PageView(
physics: const BouncingScrollPhysics(),
controller: _pageController,
children: [
///Page 1
RefreshIndicator(
strokeWidth: 3,
displacement:
MediaQuery.of(context).size.height / 2 - 200,
color: Colors.black,
backgroundColor: Colors.white,
onRefresh: () async {
getSensorInfo();
},
child: sensors.isNotEmpty
? Column(
children: [
HeaderInfo(
headerEMKey: headerEMKey,
info: info,
widget: widget,
timeDownload: timeDownload,
timeStampUtc: timeStampUtc,
sensors: sensors,
sensorsEMKey: sensorsEMKey,
scrollController: scrollController),
Expanded(
child: WidgetShot(
key: sensorsEMKey,
child: EMSensors(
sensors: sensors,
scrollController: scrollController,
)),
),
],
)
: Stack(
children: [
const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Espere...',
style: TextStyle(
color: Colors.white,
fontSize: 18)),
SizedBox(height: 20),
CircularProgressIndicator(
color: Colors.white,
),
],
),
),
Positioned(
right: 40,
bottom: 40,
child: CircleCustomButton(
sizeButton: 70,
icon: reloadingIcon,
function: () {
getSensorInfo();
},
),
),
],
)),
///Page 2
InfoBoards(info: info),
///Page 3
DownloadPage(
info: info,
testMode: widget.testMode,
)
]),
if (sensors.isNotEmpty)
CustomPageView(
widthScreen: widthScreen, pageController: _pageController),
],
));
}
}
class HeaderInfo extends StatelessWidget {
const HeaderInfo({
super.key,
required this.headerEMKey,
required this.info,
required this.widget,
required this.timeDownload,
required this.timeStampUtc,
required this.sensors,
required this.sensorsEMKey,
required this.scrollController,
});
final GlobalKey<State<StatefulWidget>> headerEMKey;
final Sensors info;
final HomePage widget;
final String timeDownload;
final String timeStampUtc;
final List<SensorType> sensors;
final GlobalKey<State<StatefulWidget>> sensorsEMKey;
final ScrollController scrollController;
@override
Widget build(BuildContext context) {
return WidgetShot(
key: headerEMKey,
child: Padding(
padding: const EdgeInsets.fromLTRB(kPadding, 50, kPadding, kPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 70,
child: HomePageTopAppBar(
info: info,
testMode: widget.testMode,
timeDownload: timeDownload,
timeStampUtc: timeStampUtc,
sensors: sensors,
headerEMKey: headerEMKey,
sensorsEMKey: sensorsEMKey,
scrollController: scrollController,
),
),
const Divider(
height: 10,
color: Colors.white,
),
const SizedBox(height: 10),
InfoConfig(
title: 'Batería: ',
value: '${info.tensionDeBateria}V',
size: kFontSize,
icon: batteryIcon),
InfoConfig(
title: 'Último valor bajado: ',
value: '${info.downloadLastAddress!} \n[$timeDownload]',
size: kFontSize - 1.5,
icon: downloadIcon),
InfoConfig(
title: 'Último valor grabado: ',
value: info.logLastAddress!,
size: kFontSize,
icon: cpuIcon),
InfoConfig(
title: 'Time Stamp: ',
value: widget.testMode
? DateFormat(
'yyyy/MM/dd HH:mm:ss')
.format(DateTime.now())
: timeStampUtc,
size: kFontSize - 1,
icon: clockIcon),
],
)),
);
}
}
///Lista de sensores de la EM
class EMSensors extends StatelessWidget {
const EMSensors({
super.key,
required this.sensors,
required this.scrollController,
});
final List<SensorType> sensors;
final ScrollController scrollController;
@override
Widget build(BuildContext context) {
return ListView.builder(
controller: scrollController,
padding: const EdgeInsets.only(
top: 0, bottom: kPaddingBottomScrollViews, left: 5, right: 5),
physics: const BouncingScrollPhysics(),
itemCount: sensors.length,
itemBuilder: (_, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: SensorCard(info: sensors[index], index: index),
);
});
}
}