搜索插件、代码仓与 APP 分类

插件详情v1.2.0

screentasia

一个 Flutter 包,可帮助您创建适用于所有屏幕的精美自适应设计,功能丰富。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
23
喜欢数
51
Pub 分数
150

安装插件

flutter pub add screentasia

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Screentasia 是一个 Flutter 包,旨在简化在所有屏幕尺寸和平台上的响应式、自适应 UI 的创建。它提供了可扩展布局、动态排版和一致间距的工具,确保设计在 Android、iOS、Web、macOS、Windows 和 Linux 上均呈现精美效果。内置工具可处理不同的屏幕密度和方向,减少样板代码,简化响应式开发。非常适合需要像素级适应性且不牺牲可维护性的应用。

适合场景

  • 跨平台应用程序开发
  • 响应式布局设计
  • 自适应字体缩放
  • 跨设备尺寸的一致性用户界面
  • 动态间距调整
  • 多屏幕优化

主要特点

  • 内置的响应式实用工具
  • 平台无关的设计支持
  • 屏幕的自动缩放
  • 灵活的布局组件
  • 面向方向的渲染
  • 排版和间距的适应性

适合对象

  • 开发跨平台应用的开发者
  • 注重UI一致性的团队
  • 具有多样化设备需求的项目
  • 设计师与开发人员协作
  • 针对多种屏幕尺寸的应用

使用建议

  • 需要理解响应式设计原则
  • 可能会为简单应用增加轻微开销
  • 最适合复杂的用户界面
  • 需要与现有布局结构集成
  • 某些内置小部件的自定义功能有限

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Screentasia

Level Up Your UI, Enjoyable & Simple

#1 Best Screens UI Package

✨ Give a star for the Repo ✨

Screentasia

A Flutter package that helps you create beautifully adaptive designs for all screens with a wealth of features.

Features

  • 🚀 Adaptive From: To adaptive sizes from different screens like Mobile, Tablet, Desktop
  • ⚡️ Adaptive Percentage: To customize Adaptive percentage for different screens sizes in percentage for the hole app or for a specific widget
  • ➗️ Percentage Sizes: Now you can customize width and height as percentages from screen
  • ❤️ As you want: You can disable Adaptive for specific screens just passing 0
  • 🏋‍♂️️ No Media Query: No need for Media Query no more

Usage

Add dependency

Please check the latest version before installation.

If there is any problem with the new version, please use the previous version

dependencies:
  flutter:
    sdk: flutter
  # add screentasia
  screentasia: ^{latest version}
Add the following imports to your Dart code
import 'package:screentasia/screentasia.dart';
Property
Property Type Default Value Description
adaptiveFrom double adaptiveFrom . mobile Used to adapt sizes from chosen screen ex: if 500 width on a desktop is equal to 50% of the screen width, will be equal to 50% to all screens,also you can use custom screen with customScreen method
adaptivePercentage AdaptivePercentage AdaptivePercentage(mobile: 100, tablet: 100, desktop: 100) For adaptive percentage in different screens, also can disable adaptive for specific screens with 0 value as parameter
builder Function null Return widget that uses the library in a property (ex: MaterialApp's theme)
child Widget null A part of the builder that its dependencies/properties don't use the library
rebuildFactor Function default Returns whether to rebuild or not when screen metrics change.

Note : You must either provide builder, child or both.

Initialize
To Initialize the Tha Adaptive with you app
The first way (You must use it once in your app)
void main() => runApp(MyApp());

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

  @override
  Widget build(BuildContext context) {
   
    return ScreentasiaInit(
      adaptiveFrom: AdaptiveFrom.mobile, //optional for custom screen ex: customScreen(400,700)
      adaptivePercentage: AdaptivePercentage(mobile:100,tablet:100,desktop:100),//optional
      builder: (context , child) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'Example',
          home: child,
        );
      },
      child: const HomePage(title: 'Example'),
    );
  }
}
Examples
In this example we will use only width for all situations to use adaptive values,Of course we can apply that concept in (Height,Font,Padding,etc)
Example using Values

We can create adaptive value for (width,height,font,etc) based on value in specific device for example (Mobile,Tablet,Desktop) or specific device dimension ( width,height )

to apply adaptive value for all screen

ex: 250.w '250 width in mobile screen'

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

  @override
  Widget build(BuildContext context) {
    return ScreentasiaInit(
      adaptiveFrom: AdaptiveFrom.mobile,
      adaptivePercentage:
          const AdaptivePercentage(mobile: 100, desktop: 100, tablet: 100),
      builder: (context, child) {
        return MaterialApp(
            debugShowCheckedModeBanner: false,
            title: 'Flutter screentasia',
            home: Scaffold(
                appBar: AppBar(
                  title: const Text('Flutter screentasia Demo  Page'),
                ),
                body: Container(
                  color: Colors.blue,
                  width: 250.w,
                )));
      },
    );
  }
}
Desktop

Tablet

Mobile

Example using Percentage

We can create adaptive value for (width,height, font,etc) based on percentage

for example we will use width percentage 'wb' in diffrent screen sizes

ex: 50wp '50 width percent in screen'

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

  @override
  Widget build(BuildContext context) {
    return ScreentasiaInit(
      adaptiveFrom: AdaptiveFrom.mobile,
      adaptivePercentage:
          const AdaptivePercentage(mobile: 100, desktop: 100, tablet: 100),
      builder: (context, child) {
        return MaterialApp(
            debugShowCheckedModeBanner: false,
            title: 'Flutter screentasia',
            home: Scaffold(
                appBar: AppBar(
                  title: const Text('Flutter screentasia Demo  Page'),
                ),
                body: Container(
                  color: Colors.blue,
                  width: 50.wp,
                )));
      },
    );
  }
}
Desktop

Tablet

Mobile

Example using Percentage in Specific Screen

We can create adaptive value for (width, height, font, etc) based on percentage

for example, we will use width percentage 'wb' in different screen sizes with different value percentages in specific screens

ex: 100wp '100 width per cent from Desktop Screen'

50wp '50 width per cent from Tablet Screen'

25wp '25 width per cent from Mobile Screen'

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

  @override
  Widget build(BuildContext context) {
    return ScreentasiaInit(
      adaptiveFrom: AdaptiveFrom.mobile,
      adaptivePercentage:
          const AdaptivePercentage(mobile: 100, desktop: 100, tablet: 100),
      builder: (context, child) {
        return MaterialApp(
            debugShowCheckedModeBanner: false,
            title: 'Flutter screentasia',
            home: Scaffold(
                appBar: AppBar(
                  title: const Text('Flutter screentasia Demo  Page'),
                ),
                body: Container(
                    color: Colors.blue,
                    width: 100.wp.ap(
                        adaptivePercentage: const AdaptivePercentage(
                            desktop: 100, tablet: 50, mobile: 25)))));
      },
    );
  }
}
Desktop

Tablet

Mobile

API
Pass the dp size of the design draft
    Screentasia().setWidth(540)  (dart sdk>=2.6 ) another way (540.w) //Adapted to screen width
    Screentasia().setHeight(200) (dart sdk>=2.6 ) another way (200.h) //Adapted to screen height, under normal circumstances, the height still uses x.w
    Screentasia().radius(200)    (dart sdk>=2.6 ) another way (200.r)    //Adapt according to the smaller of width or height
    Screentasia().setSp(24)      (dart sdk>=2.6 ) another way (24.sp) //Adapter font
    Screentasia().setPercentage(MediaQuery.sizeOf(context).width,50)   (dart sdk>=2.6 : 50.wp)    //Device width in Percentage, You can use Height just replace MediaQuery.sizeOf(context).width with MediaQuery.sizeOf(context).height
    
    EdgeInsets.all(10).w    //EdgeInsets.all(10.w)
    EdgeInsets.only(left:8,right:8).r // EdgeInsets.only(left:8.r,right:8.r).
    Radius.circular(16).w          //Radius.circular(16.w)
    BorderRadius.all(Radius.circular(16)).w  

    ap(tablet:50) //adaptive percentage, tablet 50 means that adaptive percentage 50% only on tablet screens, the default is 100% for all screens 

所属分类

源码仓库

使用此插件的项目

暂无相关数据。