rlstyles 2.0.1 copy "rlstyles: ^2.0.1" to clipboard
rlstyles: ^2.0.1 copied to clipboard

Using the writing method of RN to develop fluent to reduce the nesting of hell

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:rlstyles/main.dart';

void main() {
  runApp(Home());
}

class Home extends HookWidget {
  const Home({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final styles = {
      'header': [
        FL_Width(size: double.infinity),
        FL_Height(size: 50),
        FL_BgColor(color: Colors.white),
        FL_AlignCenter,
        FL_JustifyCenter
      ],
      'body': [FL_BgColor(color: Colors.black), FL_WFull, FL_HFull],
      'headerLeft': [
        FL_Absolute,
        FL_AbsLeft(size: 10),
        FL_AbsTop(size: 0),
        FL_AbsBottom(size: 0),
        FL_AlignCenter,
        FL_JustifyCenter,
      ],
      'headerRight': [
        FL_Absolute,
        FL_AbsRight(size: 10),
        FL_AbsTop(size: 0),
        FL_AbsBottom(size: 0),
        FL_AlignCenter,
        FL_JustifyCenter,
      ]
    };
    Widget renderHeaderLeft() {
      return View(
        styles: styles['headerLeft'],
        children: [
          Icon(
            Icons.mail,
            size: 20,
          )
        ],
      );
    }

    Widget renderHeaderRight() {
      return View(
        styles: styles['headerRight'],
        children: [TextView('ceshi')],
      );
    }

    Widget renderHeader() {
      return View(
        styles: styles['header'],
        children: [
          renderHeaderLeft(),
          TextView('12312313231'),
          renderHeaderRight()
        ],
      );
    }

    Widget renderView() {
      return View(children: [renderHeader()], styles: styles['body']);
    }

    return ScreenUtilInit(
      designSize: const Size(360, 690),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (
        context,
        Widget? child,
      ) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'First Method',
          // You can use the library anywhere in the app even in theme
          theme: ThemeData(
            primarySwatch: Colors.blue,
            textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp),
          ),
          home: Scaffold(
              body: SafeArea(
            child: renderView(),
          )),
        );
      },
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Using the writing method of RN to develop fluent to reduce the nesting of hell

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_hooks, flutter_screenutil

More

Packages that depend on rlstyles