Open infosabbir opened 6 months ago
Yes, As of flutter new update we are facing dependency issues in device preview package. Device preview needs to be updated.
Here are the logs when compiling:
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/tool_panel/sections/section.dart:39:40: Error: The getter 'subtitle2' isn't defined for the class 'TextTheme'.
'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'subtitle2'.
style: theme.textTheme.subtitle2?.copyWith(
^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/tool_panel/sections/settings.dart:56:34: Error: The getter 'backgroundColor' isn't defined for the class 'ThemeData'.
'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('flutter/packages/flutter/lib/src/material/theme_data.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'backgroundColor'.
color: toolbar.backgroundColor,
^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/tool_panel/sections/settings.dart:87:34: Error: The getter 'backgroundColor' isn't defined for the class 'ThemeData'.
'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('flutter/packages/flutter/lib/src/material/theme_data.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'backgroundColor'.
color: toolbar.backgroundColor,
^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/theme.dart:31:11: Error: No named parameter with the name 'toggleableActiveColor'.
toggleableActiveColor: accentColor,
^^^^^^^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/theme.dart:54:11: Error: No named parameter with the name 'toggleableActiveColor'.
toggleableActiveColor: accentColor,
^^^^^^^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/tool_panel/tool_panel.dart:83:34: Error: The getter 'headline6' isn't defined for the class 'TextTheme'.
'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'headline6'.
style: theme.textTheme.headline6?.copyWith(
../../../AppData/Local/Pub/Cache/hosted/pub.dev/device_preview-1.1.0/lib/src/views/tool_panel/sections/subsections/device_model.dart:175:32: Error: The getter 'subtitle2' isn't defined for the class 'TextTheme'.
'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'subtitle2'.
style: theme.textTheme.subtitle2?.copyWith(
^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m
Running Gradle task 'assembleDebug'... 61.3s
Error: Gradle task assembleDebug failed with exit code 1
Just a heads-up: You can now use device_preview: ^1.2.0
, which fixes this issue, so you can remove your workarounds.
last update not work with debugShowCheckedModeBanner: false
in my case there are no errors but any UI build defaults to what I assume is the original device size and I have to turn the device preview on and off (this needs to be repeated on every build or rebuild)
So i downgrade flutter to 3.19.6 version for using device preview. If you guys faced this issue and want to use device preivew pacakage you can also do that. I hope package developer fix this problem soon. Becuase Device preivew last updated 24 months ago. it's pretty old. I think.