update screenutil

null_safety
小赖 4 years ago
parent 0dc3065e95
commit a018cfb870

@ -3,7 +3,6 @@ import 'package:example/main_extention.dart';
import 'package:example/main_home.dart';
import 'package:example/main_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

@ -76,3 +76,4 @@ export 'theme/as_theme.dart';
//third party
export 'package:velocity_x/velocity_x.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart';

@ -32,7 +32,7 @@ class ASBottomDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
...items.sepWidget(separate: ASDivider())!,
...(items??[]).sepWidget(separate: ASDivider()),
10.hb,
_buildCancel(context),
],

@ -73,8 +73,8 @@ class ASDialog extends StatelessWidget {
),
),
),
...items
.sepWidget(separate: SizedBox(height: _widgetSpacer))!,
...(items ?? [])
.sepWidget(separate: SizedBox(height: _widgetSpacer)),
],
),
),

@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/num_extension.dart';
extension SeparateExt on List<Widget>? {
List<Widget>? sepWidget({Widget? separate}) {
if (this == null) return null;
if (this!.isEmpty) return [];
return List.generate(this!.length * 2 - 1, (index) {
extension SeparateExt on List<Widget> {
List<Widget> sepWidget({Widget? separate}) {
if (this.isEmpty) return [];
return List.generate(this.length * 2 - 1, (index) {
if (index.isEven)
return this![index ~/ 2];
return this[index ~/ 2];
else
return separate ?? 10.wb;
});

@ -109,14 +109,14 @@ class _ASCardExpandableState extends State<ASCardExpandable> {
children: [
SizedBox(),
...widget.children,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w))!,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)),
),
expanded: Column(
children: [
SizedBox(),
...(widget.custom ? <Widget>[] : widget.children),
...widget.extra,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w))!,
].sepWidget(separate: ASDivider(indent: 10.w, endIndent: 10.w)),
),
),
);

@ -23,6 +23,7 @@ class ASTheme {
textTheme: ThemeData.light().textTheme.apply(
displayColor: Color(0xFF333333),
bodyColor: Color(0xFF333333),
fontFamily: 'NotoSansSC',
),
inputDecorationTheme: InputDecorationTheme(),
primaryColor: kPrimaryColor,

@ -86,7 +86,7 @@ class _CameraViewState extends State<CameraView> {
title: '确认',
onPressed: () => Navigator.pop(context, widget.file),
),
].sepWidget(separate: ASDivider())!,
].sepWidget(separate: ASDivider()),
),
),
);

Loading…
Cancel
Save