feat: UI pages
This commit is contained in:
1 parent
fbcd33ea2b
commit
197c3e9b88
41 files changed
+1270
-274
No files matched your search
@@ -32,7 +32,33 @@ class ConstImg {
|
||||
// splash_page
|
||||
static const String splashPage = "assets/imgs/splash_page.png";
|
||||
// heart
|
||||
static const String heart = "assets/images/heart.png";
|
||||
static const String heart = "assets/imgs/heart.png";
|
||||
// hot_bg1
|
||||
static const String hotBg1 = "assets/imgs/hot_bg1.png";
|
||||
static const String hotBg2 = "assets/imgs/hot_bg2.png";
|
||||
// home_rank_bg
|
||||
static const String homeRankBg = "assets/imgs/home_rank_bg.png";
|
||||
// yellow_bg purple red
|
||||
static const String yellowBg = "assets/imgs/yellow_bg.png";
|
||||
static const String purpleBg = "assets/imgs/purple_bg.png";
|
||||
static const String redBg = "assets/imgs/red_bg.png";
|
||||
|
||||
/// pics
|
||||
static const String delete = "assets/pics/delete.png";
|
||||
static const String back = "assets/pics/back.png";
|
||||
static const String search = "assets/pics/search_icon.png";
|
||||
static const String hot = "assets/pics/hot.png";
|
||||
static const String star = "assets/pics/star.png";
|
||||
static const String look = "assets/pics/look.png";
|
||||
// bgs
|
||||
static const String likeBg = "assets/pics/like_bg.png";
|
||||
static const String collectionBg = "assets/pics/collection_bg.png";
|
||||
static const String playlogBg = "assets/pics/playlog_bg.png";
|
||||
// like_selected_bg
|
||||
static const String likeSelectedBg = "assets/pics/like_selected_bg.png";
|
||||
static const String likeUnselectBg = "assets/pics/like_unselect_bg.png";
|
||||
static const String continueWatch = "assets/pics/continue_watch.png";
|
||||
|
||||
|
||||
// nodata
|
||||
static const String noData = "assets/images/nodata.png";
|
||||
|
||||
@@ -43,11 +43,11 @@ class SkyTimeTool {
|
||||
if (value < 1000) {
|
||||
return addSeparator(value.toStringAsFixed(0));
|
||||
} else if (value < 1000000) {
|
||||
final formatted = (value / 1000).toStringAsFixed(decimalDigits);
|
||||
return '${removeTrailingZeros(formatted)}K';
|
||||
final formatted = (value / 10000).toStringAsFixed(decimalDigits);
|
||||
return '${removeTrailingZeros(formatted)}w';
|
||||
} else {
|
||||
final formatted = (value / 1000000).toStringAsFixed(decimalDigits);
|
||||
return '${removeTrailingZeros(formatted)}M';
|
||||
return '${removeTrailingZeros(formatted)}m';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
import '../help_nav.dart';
|
||||
|
||||
|
||||
class SkyAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const SkyAppBar({
|
||||
super.key,
|
||||
this.title,
|
||||
this.titleWidget,
|
||||
this.leading,
|
||||
this.actions,
|
||||
this.onBack,
|
||||
this.showBackButton = true,
|
||||
this.centerTitle = true,
|
||||
this.backgroundColor = Colors.white,
|
||||
this.foregroundColor,
|
||||
this.elevation = 0,
|
||||
this.bottom,
|
||||
this.toolbarHeight = kToolbarHeight,
|
||||
});
|
||||
|
||||
final String? title;
|
||||
final Widget? titleWidget;
|
||||
final Widget? leading;
|
||||
final List<Widget>? actions;
|
||||
final VoidCallback? onBack;
|
||||
final bool showBackButton;
|
||||
final bool centerTitle;
|
||||
final Color? backgroundColor;
|
||||
final Color? foregroundColor;
|
||||
final double elevation;
|
||||
final PreferredSizeWidget? bottom;
|
||||
final double toolbarHeight;
|
||||
|
||||
@override
|
||||
Size get preferredSize =>
|
||||
Size.fromHeight(toolbarHeight + (bottom?.preferredSize.height ?? 0));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return _buildNormalAppBar(context);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildNormalAppBar(BuildContext context) {
|
||||
|
||||
final canPop = Navigator.of(context).canPop();
|
||||
|
||||
Widget? resolvedLeading = leading;
|
||||
if (resolvedLeading == null && showBackButton && canPop) {
|
||||
resolvedLeading = IconButton(
|
||||
icon: HelpImg.asset(ConstImg.back, width: 32),
|
||||
onPressed: onBack ?? () => HelpNav.back(),
|
||||
);
|
||||
}
|
||||
|
||||
return AppBar(
|
||||
title: titleWidget ?? (title != null
|
||||
? SkyText(text: title!, fontSize: 18, fontWeight: FontWeight.bold)
|
||||
: null),
|
||||
leading: resolvedLeading,
|
||||
actions: actions,
|
||||
centerTitle: centerTitle,
|
||||
backgroundColor: backgroundColor,
|
||||
foregroundColor: foregroundColor,
|
||||
elevation: elevation,
|
||||
scrolledUnderElevation: 0,
|
||||
toolbarHeight: toolbarHeight,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../global/const/common_color.dart';
|
||||
|
||||
class SkyTextField extends StatefulWidget {
|
||||
|
||||
const SkyTextField({
|
||||
super.key,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.borderRadius = const BorderRadius.all(Radius.circular(7)),
|
||||
this.padding = const EdgeInsets.only(left: 10, right: 10, top: 2, bottom: 2),
|
||||
this.placeholder,
|
||||
this.clearButtonMode = OverlayVisibilityMode.never,
|
||||
this.prefix,
|
||||
this.suffix,
|
||||
this.keyboardType,
|
||||
this.fontSize,
|
||||
this.maxLines = 1,
|
||||
this.maxLength,
|
||||
this.onChanged,
|
||||
this.inputFormatters,
|
||||
this.height = 40.0,
|
||||
this.width,
|
||||
this.obscureText = false,
|
||||
this.bgColor,
|
||||
this.textInputAction,
|
||||
this.onSubmitted,
|
||||
this.onTap,
|
||||
this.readOnly,
|
||||
this.border,
|
||||
this.onEditingComplete,
|
||||
this.textColor,
|
||||
this.showBottomBorder,
|
||||
});
|
||||
|
||||
final Function()? onEditingComplete;
|
||||
final Color? textColor;
|
||||
final double? width;
|
||||
final bool? readOnly;
|
||||
final GestureTapCallback? onTap;
|
||||
final ValueChanged<String>? onSubmitted;
|
||||
final TextInputAction? textInputAction;
|
||||
final TextEditingController? controller;
|
||||
final FocusNode? focusNode;
|
||||
|
||||
final BorderRadius borderRadius;
|
||||
final Border? border;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final String? placeholder;
|
||||
// final Color? placeholderColor;
|
||||
final OverlayVisibilityMode clearButtonMode;
|
||||
final Widget? prefix;
|
||||
final Widget? suffix;
|
||||
final TextInputType? keyboardType;
|
||||
final double? fontSize;
|
||||
final int? maxLines;
|
||||
final int? maxLength;
|
||||
final ValueChanged<String>? onChanged;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final double? height;
|
||||
final bool obscureText;
|
||||
final Color? bgColor;
|
||||
final bool? showBottomBorder;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ComTextFieldState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ComTextFieldState extends State<SkyTextField> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
|
||||
return Container(
|
||||
height: widget.height, width: widget.width,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.bgColor ?? Colors.white,
|
||||
borderRadius: widget.borderRadius,
|
||||
border: widget.border
|
||||
),
|
||||
padding: widget.padding,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: CupertinoTextField(
|
||||
controller: widget.controller,
|
||||
readOnly: widget.readOnly ?? false,
|
||||
focusNode: widget.focusNode,
|
||||
decoration: widget.showBottomBorder==true ? BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Colors.grey.shade400,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
) : BoxDecoration(),
|
||||
placeholder: widget.placeholder,
|
||||
placeholderStyle: TextStyle(
|
||||
fontSize: widget.fontSize ?? 14,
|
||||
color: CommonColor.withValue('#707488'),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: widget.fontSize ?? 14,
|
||||
color: widget.textColor ?? Colors.black,
|
||||
),
|
||||
prefix: widget.prefix,
|
||||
clearButtonMode: widget.clearButtonMode,
|
||||
keyboardType: widget.keyboardType,
|
||||
maxLines: widget.maxLines,
|
||||
maxLength: widget.maxLength,
|
||||
onChanged: widget.onChanged,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
obscureText: widget.obscureText,
|
||||
textInputAction: widget.textInputAction ?? TextInputAction.done,
|
||||
onSubmitted: widget.onSubmitted,
|
||||
onTap: widget.onTap,
|
||||
onEditingComplete: widget.onEditingComplete,
|
||||
)),
|
||||
if (widget.suffix != null) widget.suffix!,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user