scaled_window 1.0.0 copy "scaled_window: ^1.0.0" to clipboard
scaled_window: ^1.0.0 copied to clipboard

Render a widget/app at a custom resolution. Useful when developing for multiple environments.

example/lib/main.dart

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

void main() {
  runApp(
    ScaledWindow(
      resolution: Size(1366, 768),
      builder: (_, scale) => MyApp(scale: scale),
    ),
  );
}

class MyApp extends StatelessWidget {
  double scale;
  MyApp({Key? key, required this.scale}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final width = MediaQuery.of(context).size.width - 50;
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.grey.shade200,
        appBar: AppBar(title: const Text('A Desktop App')),
        body: Padding(
          padding: const EdgeInsets.all(10),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              Material(
                elevation: 10,
                child: SizedBox(
                  width: width / 4,
                  child: const RotatedBox(
                    quarterTurns: 1,
                    child: FittedBox(
                      child: Text('Left Sidebar'),
                    ),
                  ),
                ),
              ),
              const SizedBox(width: 15),
              Material(
                elevation: 10,
                child: SizedBox(
                  width: width / 2,
                  child: FittedBox(
                    child: Text('Main view, try resizing the window, (scale: $scale)'),
                  ),
                ),
              ),
              const SizedBox(width: 15),
              Material(
                elevation: 10,
                child: SizedBox(
                  width: width / 4,
                  child: const RotatedBox(
                    quarterTurns: 1,
                    child: FittedBox(
                      child: Text('Right Sidebar'),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
0
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

Render a widget/app at a custom resolution. Useful when developing for multiple environments.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on scaled_window