autoshot 1.2.0 copy "autoshot: ^1.2.0" to clipboard
autoshot: ^1.2.0 copied to clipboard

Automate App Store and Play Store screenshot generation across multiple devices, locales, and screens with web download and mobile file export.

example/lib/main.dart

import 'package:autoshot/autoshot.dart';
import 'package:flutter/material.dart';

final GlobalKey<NavigatorState> appNavigatorKey = GlobalKey<NavigatorState>();

void main() {
  runApp(
    Autoshot(
      config: AutoshotConfig(
        screens: [
          ScreenEntry.route(
            name: 'home',
            navigate: (_) async {
              appNavigatorKey.currentState?.pushNamedAndRemoveUntil(
                '/home',
                (route) => false,
              );
            },
          ),
          ScreenEntry.route(
            name: 'detail',
            navigate: (_) async {
              appNavigatorKey.currentState?.pushNamedAndRemoveUntil(
                '/detail',
                (route) => false,
              );
            },
          ),
        ],
        locales: const [Locale('en', 'US'), Locale('ar', 'SA')],
        devices: [Devices.ios.iPhone13ProMax],
        theme: ThemeData(colorSchemeSeed: Colors.indigo, useMaterial3: true),
        darkTheme: ThemeData(
          colorSchemeSeed: Colors.indigo,
          brightness: Brightness.dark,
          useMaterial3: true,
        ),
      ),
      builder: (context) => MyApp(navigatorKey: appNavigatorKey),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key, required this.navigatorKey});

  final GlobalKey<NavigatorState> navigatorKey;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: navigatorKey,
      // ignore: deprecated_member_use
      useInheritedMediaQuery: true,
      locale: DevicePreview.locale(context),
      builder: DevicePreview.appBuilder,
      theme: ThemeData(colorSchemeSeed: Colors.indigo, useMaterial3: true),
      darkTheme: ThemeData(
        colorSchemeSeed: Colors.indigo,
        brightness: Brightness.dark,
        useMaterial3: true,
      ),
      debugShowCheckedModeBanner: false,
      initialRoute: '/home',
      routes: {
        '/home': (_) => const HomeScreen(),
        '/detail': (_) => const DetailScreen(),
      },
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final languageCode = Localizations.localeOf(context).languageCode;
    final isArabic = languageCode == 'ar';

    return Scaffold(
      appBar: AppBar(title: Text(isArabic ? 'الرئيسية' : 'Home')),
      body: ListView.builder(
        itemCount: 20,
        itemBuilder: (context, index) => ListTile(
          leading: CircleAvatar(child: Text('${index + 1}')),
          title: Text('${isArabic ? 'عنصر' : 'Item'} ${index + 1}'),
          subtitle: Text(
            isArabic ? 'اضغط لعرض التفاصيل' : 'Tap to see details',
          ),
          onTap: () {},
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.add),
      ),
    );
  }
}

class DetailScreen extends StatelessWidget {
  const DetailScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final languageCode = Localizations.localeOf(context).languageCode;
    final isArabic = languageCode == 'ar';

    return Scaffold(
      appBar: AppBar(title: Text(isArabic ? 'التفاصيل' : 'Detail')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(
              Icons.photo_library_rounded,
              size: 80,
              color: Theme.of(context).colorScheme.primary,
            ),
            const SizedBox(height: 24),
            Text(
              isArabic ? 'واجهة تفاصيل جميلة' : 'Beautiful Detail View',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
            const SizedBox(height: 8),
            Text(
              isArabic
                  ? 'يتم التقاط هذه الشاشة لكل جهاز ولكل لغة.'
                  : 'This screen is captured for every device and locale.',
              style: Theme.of(context).textTheme.bodyMedium,
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
150
points
152
downloads

Publisher

verified publisherandronasef.dev

Weekly Downloads

Automate App Store and Play Store screenshot generation across multiple devices, locales, and screens with web download and mobile file export.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

archive, device_preview, flutter, path_provider, provider

More

Packages that depend on autoshot