flutter_responsive_layouts 0.0.9 copy "flutter_responsive_layouts: ^0.0.9" to clipboard
flutter_responsive_layouts: ^0.0.9 copied to clipboard

discontinuedreplaced by: taastrap

A flutter package to handle responsive layouts in flutter

example/example.dart

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

import 'package:flutter_responsive_layouts/flutter_responsive_layouts.dart';

/// @Description: show the app bar just on iphone 4's layout or iphone x's layout

/// The main function to start the application
main() async{
  runApp(MyApp());
}


class MyApp extends StatelessWidget {

  /// @Description:
  ///   - it returns the device type based on this two layouts
  /// @Params:
  ///   - BoxConstraints size: the size of the current device
  /// @Return:
  ///   - int: the device type value
  int _deviceType(BoxConstraints size){
    Iphone4 _iphone4Layout = Iphone4(null, null, size.minWidth as int);
    IphoneX _iphoneXLayout = IphoneX(null, null, size.minWidth as int);
    return _iphoneXLayout.isPortraitLandscape() ? 0 : (_iphone4Layout.isPortraitLandscape() ? 1 : 2);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: LayoutBuilder(builder: (context, size){
        return Scaffold(
          appBar: _deviceType(size) == 0 || _deviceType(size) == 1 ? AppBar() : null,
          body: Container(),
        );
      },)
    );
  }
}
1
likes
120
pub points
1%
popularity

Publisher

unverified uploader

A flutter package to handle responsive layouts in flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_responsive_layouts