flutter_screen_scaler 2.0.0 copy "flutter_screen_scaler: ^2.0.0" to clipboard
flutter_screen_scaler: ^2.0.0 copied to clipboard

outdated

A package to resize your widgets according to the screen size with the use of percentages.

example/example.dart

import 'package:flutter/material.dart';
import '../lib/flutter_screen_scaler.dart';

void main() => runApp(ExampleApp());

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Screen ScreenScaler Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ExamplePage(),
    );
  }
}

class ExamplePage extends StatefulWidget {
  ExamplePage({Key key}) : super(key: key);

  @override
  _ExamplePageState createState() => _ExamplePageState();
}

class _ExamplePageState extends State<ExamplePage> {
  @override
  Widget build(BuildContext context) {
    ScreenScaler scaler = ScreenScaler()..init(context);

    return Scaffold(
      body: Container(
        color: Colors.amber,
        child: Column(
          children: <Widget>[
            // to prevent overlapping with the status bar
            Container(height: 30),
            Container(
              alignment: Alignment.center,
              color: Colors.white,
              // take 50% of the height
              height: scaler.getHeight(50),
              // take 50% of the height
              width: scaler.getWidth(90),
              child: Text(
                "Height:50%\nWidth:90%\nFont Size:15%",
                style: TextStyle(
                  fontSize: scaler.getTextSize(15),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
25
likes
40
pub points
81%
popularity

Publisher

unverified uploader

A package to resize your widgets according to the screen size with the use of percentages.

Repository (GitHub)
View/report issues

License

GPL-3.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_screen_scaler