0 purchases
flutter mockup
flutter_midi_pro #
The flutter_mockup package provides a simple way to create mockups on flat surfaces with your desings and get a photo of it.
Installation #
This package including the screenshot package as a dependency. To use this plugin, add flutter_mockup and screenshot using terminal or pubspec.yaml file.
flutter pub add flutter_mockup
flutter pub add screenshot
copied to clipboard
Usage #
To use this package, follow the below steps:
Import the package in your Dart code:
import 'package:flutter_mockup/flutter_mockup.dart';
import 'package:screenshot/screenshot.dart';
copied to clipboard
Create a MockupController:
Load SoundFont File #
final MockupController _controller = MockupController(
screenshotController: ScreenshotController(),
backgroundUrl: 'assets/tshirt.png',
designUrl: 'assets/design2.png',
);
copied to clipboard
Use MockupWidget to display your mockup:
MockupWidget(
controller: _controller,
)
copied to clipboard
Capture and save the image:
final image = await _controller.screenshotController.capture();
// Your code to save image
copied to clipboard
Example #
Here's an example of how you could use the flutter_mockup package to create a mockup of a t-shirt design:
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_mockup/flutter_mockup.dart';
import 'package:screenshot/screenshot.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatefulWidget {
const MainApp({super.key});
@override
State<MainApp> createState() => _MainAppState();
}
class _MainAppState extends State<MainApp> {
final MockupController _controller = MockupController(
screenshotController: ScreenshotController(),
backgroundUrl: 'assets/tshirt.png',
designUrl: 'assets/design2.png',
);
getBytesOfMockup() async {
final image = await _controller.screenshotController.capture();
return image;
}
Future saveImage(Uint8List image) async {
final bytes = getBytesOfMockup();
//TODO: Your code to save image
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: MockupWidget(
controller: _controller,
),
),
),
Center(
child: ElevatedButton(
onPressed: () async {
final image = await _controller.screenshotController.capture();
saveImage(image!);
},
child: const Text('Save Image'),
),
)
],
),
),
);
}
}
copied to clipboard
Issues and Feedback #
For any issues with the package, or for feedback, please file an issue on our GitHub repository.
Contributions #
Contributions are welcome! Please feel free to submit a PR or open an issue.
Contact #
If you have any questions or suggestions, feel free to contact the package maintainer, Melih Hakan Pektas, via email or through GitHub.
Thank you for contributing to flutter_piano_pro!
License #
This project is licensed under the MIT License. See the LICENSE file for details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.