Skip to content

Commit

Permalink
Merge pull request #1 from TonghuaLee/feature/switch_broad
Browse files Browse the repository at this point in the history
Feature/switch broad
  • Loading branch information
TonghuaLee authored Feb 21, 2023
2 parents 9fb0d10 + 79ed97b commit 7464934
Show file tree
Hide file tree
Showing 12 changed files with 1,126 additions and 241 deletions.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: Flutter

SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854

PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
PODFILE CHECKSUM: 663715e941f9adb426e33bf9376914006f9ea95b

COCOAPODS: 1.10.1
COCOAPODS: 1.11.3
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
203 changes: 108 additions & 95 deletions example/lib/page/td_loading_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import 'package:flutter/material.dart';
import 'package:tdesign_flutter/td_export.dart';

import '../../base/example_widget.dart';
import '../annotation/demo.dart';

Expand All @@ -23,69 +24,77 @@ class _TDLoadingPageState extends State<TDLoadingPage> {
@override
Widget build(BuildContext context) {
return ExamplePage(
title: '加载 Loading',
backgroundColor: TDTheme.of(context).whiteColor1,
exampleCodeGroup: 'loading',
desc: '用于表示页面或操作的加载状态,给予用户反馈的同时减缓等待的焦虑感,由一个或一组反馈动效组成。',
children: [
ExampleModule(title: '组件类型', children: [
ExampleItem(desc: '纯图标', builder: _buildPureIconLoading),
ExampleItem(
desc: '图标加文字横向', builder: _buildTextIconHorizontalLoading),
ExampleItem(
desc: '图标加文字竖向', builder: _buildTextIconVerticalLoading),
ExampleItem(desc: '纯文字', builder: _buildPureTextLoading),
]),
ExampleModule(title: '组件尺寸', children: [
ExampleItem(desc: '大尺寸', builder: _buildLargeLoading),
ExampleItem(desc: '中尺寸', builder: _buildMediumLoading),
ExampleItem(desc: '小尺寸', builder: _buildSmallLoading),
]),
ExampleModule(title: '加载速度', children: [
ExampleItem(desc: '调整加载速度', builder: _buildCustomSpeedLoading),
]),
],
test: [
ExampleItem(
desc: '带图标的失败横向Loading',
ignoreCode: true,
builder: (_){
return Padding(padding: const EdgeInsets.all(16),
child: TDLoading(
icon: TDLoadingIcon.circle,
size: TDLoadingSize.small,
axis: Axis.horizontal,
text: '加载失败',
refreshWidget: GestureDetector(
child: TDText('刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,),
onTap: (){
TDToast.showText('刷新', context: context);
},
),
),);
}),
ExampleItem(
desc: '带图标的失败竖向Loading',
ignoreCode: true,
builder: (_){
return Container(padding: const EdgeInsets.all(16),
child: TDLoading(
icon: TDLoadingIcon.circle,
size: TDLoadingSize.small,
text: '加载失败',
refreshWidget: GestureDetector(
child: TDText('刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,),
onTap: (){
TDToast.showText('刷新', context: context);
},
),
),);
}),
],);
title: '加载 Loading',
backgroundColor: TDTheme.of(context).whiteColor1,
exampleCodeGroup: 'loading',
desc: '用于表示页面或操作的加载状态,给予用户反馈的同时减缓等待的焦虑感,由一个或一组反馈动效组成。',
children: [
ExampleModule(title: '组件类型', children: [
ExampleItem(desc: '纯图标', builder: _buildPureIconLoading),
ExampleItem(
desc: '图标加文字横向', builder: _buildTextIconHorizontalLoading),
ExampleItem(desc: '图标加文字竖向', builder: _buildTextIconVerticalLoading),
ExampleItem(desc: '纯文字', builder: _buildPureTextLoading),
]),
ExampleModule(title: '组件尺寸', children: [
ExampleItem(desc: '大尺寸', builder: _buildLargeLoading),
ExampleItem(desc: '中尺寸', builder: _buildMediumLoading),
ExampleItem(desc: '小尺寸', builder: _buildSmallLoading),
]),
ExampleModule(title: '加载速度', children: [
ExampleItem(desc: '调整加载速度', builder: _buildCustomSpeedLoading),
]),
],
test: [
ExampleItem(
desc: '带图标的失败横向Loading',
ignoreCode: true,
builder: (_) {
return Padding(
padding: const EdgeInsets.all(16),
child: TDLoading(
icon: TDLoadingIcon.circle,
size: TDLoadingSize.small,
axis: Axis.horizontal,
text: '加载失败',
refreshWidget: GestureDetector(
child: TDText(
'刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,
),
onTap: () {
TDToast.showText('刷新', context: context);
},
),
),
);
}),
ExampleItem(
desc: '带图标的失败竖向Loading',
ignoreCode: true,
builder: (_) {
return Container(
padding: const EdgeInsets.all(16),
child: TDLoading(
icon: TDLoadingIcon.circle,
size: TDLoadingSize.small,
text: '加载失败',
refreshWidget: GestureDetector(
child: TDText(
'刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,
),
onTap: () {
TDToast.showText('刷新', context: context);
},
),
),
);
}),
],
);
}

@Demo(group: 'loading')
Expand Down Expand Up @@ -174,10 +183,12 @@ class _TDLoadingPageState extends State<TDLoadingPage> {
size: TDLoadingSize.small,
text: '加载失败',
refreshWidget: GestureDetector(
child: TDText('刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,),
onTap: (){
child: TDText(
'刷新',
font: TDTheme.of(context).fontBodySmall,
textColor: TDTheme.of(context).brandNormalColor,
),
onTap: () {
TDToast.showText('刷新', context: context);
},
),
Expand Down Expand Up @@ -224,37 +235,39 @@ class _TDLoadingPageState extends State<TDLoadingPage> {
]);
}


double _currentSliderValue = 1000;

/// 自定义尺寸
@Demo(group: 'loading')
Widget _buildCustomSpeedLoading(BuildContext context) {
return Padding(padding: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TDLoading(
size: TDLoadingSize.small,
icon: TDLoadingIcon.circle,
axis: Axis.horizontal,
text: '加载中…',
duration: _currentSliderValue.round(),
),
Slider(
value: _currentSliderValue,
max: 2000,
min: -20,
divisions: 100,
label: _currentSliderValue.round().toString(),
onChanged: (double value) {
setState(() {
_currentSliderValue = value;
});
},
),
],
),);
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TDLoading(
size: TDLoadingSize.small,
icon: TDLoadingIcon.circle,
axis: Axis.horizontal,
text: '加载中…',
duration: _currentSliderValue.round(),
),
Slider(
value: _currentSliderValue,
max: 2000,
min: -20,
divisions: 100,
label: _currentSliderValue.round().toString(),
onChanged: (double value) {
setState(() {
_currentSliderValue = value;
});
},
),
],
),
);
}
}
Loading

0 comments on commit 7464934

Please sign in to comment.