Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device preview is not working flutter new version 3.22.0 version. But it's working before version as well. #247

Open
infosabbir opened this issue May 19, 2024 · 7 comments

Comments

@infosabbir
Copy link

No description provided.

@infosabbir
Copy link
Author

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.

@SameerGhaffar
Copy link

Yes, As of flutter new update we are facing dependency issues in device preview package. Device preview needs to be updated.

@jcobb48
Copy link

jcobb48 commented May 20, 2024

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

@tobiasht
Copy link

#245 seems to solve the issue. Hopefully, it's merged soon.

@jakobhec
Copy link

Just a heads-up: You can now use device_preview: ^1.2.0, which fixes this issue, so you can remove your workarounds.

@TechComet
Copy link

TechComet commented Jun 5, 2024

last update not work with debugShowCheckedModeBanner: false

@Osama-Al-Fawaz
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants