Open robinbakkerus opened 1 year ago
Here,you can try these few adjustments in your code. 1)Ensure that the text widget is wrapped in a Center widget so that the "demo" text is centered on the screen. 2)Use the Key parameter for the MyApp constructor instead of super.key. Like( const MyApp({Key? key}) : super(key: key); // Use Key instead of super.key) 3)Or you can try Importing kReleaseMode from flutter/foundation.dart to properly handle enabling DevicePreview only during development.
Hi,
No these changes do not help: [image: afbeelding.png]
This is the code: import 'package:device_preview/device_preview.dart'; import 'package:flutter/material.dart';
void main() { DevicePreview( enabled: true, //kReleaseMode, builder: (context) => const MyApp(), // Wrap your app ); }
class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key);
@override Widget build(BuildContext context) { return MaterialApp( locale: DevicePreview.locale(context), builder: DevicePreview.appBuilder, home: const Material( child: Center(child: Text('demo')), )); } }
On Thu, Aug 10, 2023 at 7:32 PM Udit Soni @.***> wrote:
Here,you can try these few adjustements in your code. 1)Ensure that the text widget is wrapped in a Center widget so that the "demo" text is centered on the screen. 2)Use the Key parameter for the MyApp constructor instead of super.key. Like( const MyApp({Key? key}) : super(key: key); // Use Key instead of super.key) 3)Or you can try Importing kReleaseMode from flutter/foundation.dart to properly handle enabling DevicePreview only during development.
— Reply to this email directly, view it on GitHub https://github.com/aloisdeniel/flutter_device_preview/issues/231#issuecomment-1673628958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWA2JE2GWBGJYLRY5YSPLXUULMJANCNFSM6AAAAAA3JXXWJU . You are receiving this because you authored the thread.Message ID: @.***>
-- met vriendelijke groeten Robin Bakkerus @.***
Hi,
My bad ! Your package is working, once you startup Flutter correctly. This was the issue:
void main() { DevicePreview(
instead of: void main() { runApp(DevicePreview(
(runApp was missing!)
gr Robin
On Mon, Aug 14, 2023 at 12:33 PM Robin Bakkerus @.***> wrote:
Hi,
No these changes do not help: [image: afbeelding.png]
This is the code: import 'package:device_preview/device_preview.dart'; import 'package:flutter/material.dart';
void main() { DevicePreview( enabled: true, //kReleaseMode, builder: (context) => const MyApp(), // Wrap your app ); }
class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key);
@override Widget build(BuildContext context) { return MaterialApp( locale: DevicePreview.locale(context), builder: DevicePreview.appBuilder, home: const Material( child: Center(child: Text('demo')), )); } }
On Thu, Aug 10, 2023 at 7:32 PM Udit Soni @.***> wrote:
Here,you can try these few adjustements in your code. 1)Ensure that the text widget is wrapped in a Center widget so that the "demo" text is centered on the screen. 2)Use the Key parameter for the MyApp constructor instead of super.key. Like( const MyApp({Key? key}) : super(key: key); // Use Key instead of super.key) 3)Or you can try Importing kReleaseMode from flutter/foundation.dart to properly handle enabling DevicePreview only during development.
— Reply to this email directly, view it on GitHub https://github.com/aloisdeniel/flutter_device_preview/issues/231#issuecomment-1673628958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWA2JE2GWBGJYLRY5YSPLXUULMJANCNFSM6AAAAAA3JXXWJU . You are receiving this because you authored the thread.Message ID: @.***>
-- met vriendelijke groeten Robin Bakkerus @.***
-- met vriendelijke groeten Robin Bakkerus @.***
@robinbakkerus im glad that you able to figure it out, keep growing and enjoy your ride with flutter ;)
This very basic implementation only displays a blank page.
flutter doctor =>
flutter --version =>
And I tested this app with the following commands: