suit 1.1.0 copy "suit: ^1.1.0" to clipboard
suit: ^1.1.0 copied to clipboard

A library of platform adaptation scheme based on the ViewPort(vw, vh) and Relative Position(rw, rh).

example/main.dart

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

void main() => runApp(MaterialApp(home: App()));

class App extends StatefulWidget {
  @override
  _AppState createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  Widget build(BuildContext context) {
    /// [Adapter.initialize] You can write it to initialize `the global viewport adapter` here
    Adapter.initialize(context);

    return Scaffold(
      appBar: AppBar(),
      body: Container(child: RelativeWidget(), width: 60.vw, height: 75.8.vh),
    );
  }
}

class RelativeWidget extends StatelessWidget {
  const RelativeWidget({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    /// Example: [double.rw]. Using `the percentage adapter based on Relative Position` here.
    return Text('hello', style: TextStyle(fontSize: 20.rw(context)));

    /// Or use the other way:
    /// ```
    /// var adapter = RAdapter(context);
    /// return Text('hello', style: TextStyle(fontSize: adapter.setRW(20)));
    /// ```
  }
}
1
likes
140
pub points
24%
popularity

Publisher

unverified uploader

A library of platform adaptation scheme based on the ViewPort(vw, vh) and Relative Position(rw, rh).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on suit