Skip to content

Commit

Permalink
Merge pull request #438 from hkaikai/dependence/easyrefresh
Browse files Browse the repository at this point in the history
升级easy refresh到最新版本,兼容v2和v3写法;修复鸿蒙编译错误
  • Loading branch information
Luozf12345 authored Jan 9, 2025
2 parents 5bc2de8 + 0411962 commit 98be576
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class IntlResourceDelegate extends TDResourceDelegate {
@override
String get releaseRefresh => AppLocalizations.of(context)!.releaseRefresh;

@override
String get pullToRefresh => AppLocalizations.of(context)!.pullToRefresh;

@override
String get completeRefresh => AppLocalizations.of(context)!.completeRefresh;

@override
String get reset => AppLocalizations.of(context)!.reset;

Expand Down
2 changes: 2 additions & 0 deletions tdesign-component/example/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"other": "Other",
"refreshing": "Refreshing",
"releaseRefresh": "ReleaseRefresh",
"pullToRefresh": "PullToRefresh",
"completeRefresh": "CompleteRefresh",
"reset": "Reset",
"days": "days",
"hours": "hours",
Expand Down
2 changes: 2 additions & 0 deletions tdesign-component/example/lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"other": "其它",
"refreshing": "正在刷新",
"releaseRefresh": "松开刷新",
"pullToRefresh": "下拉刷新",
"completeRefresh": "刷新完成",
"reset": "重置",
"days": "天",
"hours": "时",
Expand Down
75 changes: 38 additions & 37 deletions tdesign-component/example/lib/page/td_refresh_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*
*/

import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import '../../base/example_widget.dart';
Expand All @@ -25,11 +25,11 @@ class _TdPullDownRefreshPageState extends State<TdPullDownRefreshPage> {
@override
Widget build(BuildContext context) {
return ExamplePage(
title: tdTitle(),
exampleCodeGroup: 'refresh',
desc: '用于快速刷新页面信息,刷新可以是整页刷新也可以是页面的局部刷新。',
showSingleChild: true,
singleChild: CodeWrapper(builder: _buildRefresh),
title: tdTitle(),
exampleCodeGroup: 'refresh',
desc: '用于快速刷新页面信息,刷新可以是整页刷新也可以是页面的局部刷新。',
showSingleChild: true,
singleChild: CodeWrapper(builder: _buildRefresh),
);
}

Expand All @@ -38,41 +38,42 @@ class _TdPullDownRefreshPageState extends State<TdPullDownRefreshPage> {
return EasyRefresh(
// 下拉样式
header: TDRefreshHeader(),
child: Column(
children: [
Container(
height: 171,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TDTheme.of(context).grayColor1,
borderRadius: BorderRadius.all(
Radius.circular(TDTheme.of(context).radiusLarge))),
margin: const EdgeInsets.only(left: 16, right: 16),
child: TDText(
PlatformUtil.isWeb ? 'Web暂不支持下拉,请下载安装apk体验' : '拖拽该区域演示 顶部下拉刷新',
font: TDTheme.of(context).fontBodyLarge,
textColor: TDTheme.of(context).fontGyColor4,
child: SingleChildScrollView(
child: Column(
children: [
Container(
height: 171,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TDTheme.of(context).grayColor1,
borderRadius: BorderRadius.all(Radius.circular(TDTheme.of(context).radiusLarge))),
margin: const EdgeInsets.only(left: 16, right: 16),
child: TDText(
PlatformUtil.isWeb ? 'Web暂不支持下拉,请下载安装apk体验' : '拖拽该区域演示 顶部下拉刷新',
font: TDTheme.of(context).fontBodyLarge,
textColor: TDTheme.of(context).fontGyColor4,
),
),
),
Container(
height: 70,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TDTheme.of(context).grayColor1,
borderRadius: BorderRadius.all(
Radius.circular(TDTheme.of(context).radiusLarge))),
margin: const EdgeInsets.only(top: 16, left: 16, right: 16),
child: TDText(
'下拉刷新次数:${count}',
font: TDTheme.of(context).fontBodyLarge,
textColor: TDTheme.of(context).fontGyColor4,
Container(
height: 70,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TDTheme.of(context).grayColor1,
borderRadius: BorderRadius.all(Radius.circular(TDTheme.of(context).radiusLarge))),
margin: const EdgeInsets.only(top: 16, left: 16, right: 16),
child: TDText(
'下拉刷新次数:${count}',
font: TDTheme.of(context).fontBodyLarge,
textColor: TDTheme.of(context).fontGyColor4,
),
),
),
],
const SizedBox(height: 500),
],
),
),
// 下拉刷新回调
onRefresh: () async {
await Future.delayed(const Duration(seconds: 2), () {
onRefresh: () {
Future.delayed(const Duration(seconds: 2), () {
setState(() {
count++;
});
Expand Down
Loading

0 comments on commit 98be576

Please sign in to comment.