From cbc552424e8d094bfee18e26463acc81dd18d0da Mon Sep 17 00:00:00 2001 From: Luozf12345 <2515187986@qq.com> Date: Wed, 24 Jul 2024 19:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/code/drawer._buildBaseSimple.txt | 4 +-- .../assets/code/drawer._buildBottomSimple.txt | 4 +-- .../assets/code/drawer._buildIconSimple.txt | 4 +-- .../assets/code/drawer._buildTitleSimple.txt | 4 +-- tdesign-site/src/drawer/README.md | 32 +++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tdesign-component/example/assets/code/drawer._buildBaseSimple.txt b/tdesign-component/example/assets/code/drawer._buildBaseSimple.txt index 28a522817..dc782b14f 100644 --- a/tdesign-component/example/assets/code/drawer._buildBaseSimple.txt +++ b/tdesign-component/example/assets/code/drawer._buildBaseSimple.txt @@ -1,7 +1,7 @@ Widget _buildBaseSimple(BuildContext context) { /// 获取navBar尺寸 - var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox; + var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?; return TDButton( text: '基础抽屉', isBlock: true, @@ -12,7 +12,7 @@ Widget _buildBaseSimple(BuildContext context) { TDDrawer( context, visible: true, - drawerTop: renderBox.size.height, + drawerTop: renderBox?.size.height, items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(), onItemClick: (index, item) { print('drawer item被点击,index:$index,title:${item.title}'); diff --git a/tdesign-component/example/assets/code/drawer._buildBottomSimple.txt b/tdesign-component/example/assets/code/drawer._buildBottomSimple.txt index 10792f330..1a95a1790 100644 --- a/tdesign-component/example/assets/code/drawer._buildBottomSimple.txt +++ b/tdesign-component/example/assets/code/drawer._buildBottomSimple.txt @@ -1,7 +1,7 @@ Widget _buildBottomSimple(BuildContext context) { /// 获取navBar尺寸 - var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox; + var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?; return TDButton( text: '带底部插槽样式', isBlock: true, @@ -12,7 +12,7 @@ Widget _buildBottomSimple(BuildContext context) { TDDrawer( context, visible: true, - drawerTop: renderBox.size.height, + drawerTop: renderBox?.size.height, title: '标题', placement: TDDrawerPlacement.left, items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(), diff --git a/tdesign-component/example/assets/code/drawer._buildIconSimple.txt b/tdesign-component/example/assets/code/drawer._buildIconSimple.txt index da2e08368..7b444146c 100644 --- a/tdesign-component/example/assets/code/drawer._buildIconSimple.txt +++ b/tdesign-component/example/assets/code/drawer._buildIconSimple.txt @@ -1,7 +1,7 @@ Widget _buildIconSimple(BuildContext context) { /// 获取navBar尺寸 - var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox; + var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?; return TDButton( text: '带图标抽屉', isBlock: true, @@ -12,7 +12,7 @@ Widget _buildIconSimple(BuildContext context) { TDDrawer( context, visible: true, - drawerTop: renderBox.size.height, + drawerTop: renderBox?.size.height, items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}', icon: const Icon(TDIcons.app))).toList(), ); }, diff --git a/tdesign-component/example/assets/code/drawer._buildTitleSimple.txt b/tdesign-component/example/assets/code/drawer._buildTitleSimple.txt index d447a5eb4..10d327d99 100644 --- a/tdesign-component/example/assets/code/drawer._buildTitleSimple.txt +++ b/tdesign-component/example/assets/code/drawer._buildTitleSimple.txt @@ -1,7 +1,7 @@ Widget _buildTitleSimple(BuildContext context) { /// 获取navBar尺寸 - var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox; + var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?; return TDButton( text: '带图标抽屉', isBlock: true, @@ -12,7 +12,7 @@ Widget _buildTitleSimple(BuildContext context) { TDDrawer( context, visible: true, - drawerTop: renderBox.size.height, + drawerTop: renderBox?.size.height, title: '标题', placement: TDDrawerPlacement.left, items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(), diff --git a/tdesign-site/src/drawer/README.md b/tdesign-site/src/drawer/README.md index d7bc623ae..c414e2ade 100644 --- a/tdesign-site/src/drawer/README.md +++ b/tdesign-site/src/drawer/README.md @@ -28,7 +28,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
Widget _buildBaseSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '基础抽屉',
isBlock: true,
@@ -39,7 +39,7 @@ Widget _buildBaseSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),
onItemClick: (index, item) {
print('drawer item被点击,index:$index,title:${item.title}');
@@ -58,7 +58,7 @@ Widget _buildBaseSimple(BuildContext context) {
Widget _buildBaseSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '基础抽屉',
isBlock: true,
@@ -69,7 +69,7 @@ Widget _buildBaseSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),
onItemClick: (index, item) {
print('drawer item被点击,index:$index,title:${item.title}');
@@ -90,7 +90,7 @@ Widget _buildBaseSimple(BuildContext context) {
Widget _buildIconSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带图标抽屉',
isBlock: true,
@@ -101,7 +101,7 @@ Widget _buildIconSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}', icon: const Icon(TDIcons.app))).toList(),
);
},
@@ -117,7 +117,7 @@ Widget _buildIconSimple(BuildContext context) {
Widget _buildIconSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带图标抽屉',
isBlock: true,
@@ -128,7 +128,7 @@ Widget _buildIconSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
items: List.generate(30, (index) => TDDrawerItem(title: '菜单${_nums[index]}', icon: const Icon(TDIcons.app))).toList(),
);
},
@@ -147,7 +147,7 @@ Widget _buildIconSimple(BuildContext context) {
Widget _buildTitleSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带图标抽屉',
isBlock: true,
@@ -158,7 +158,7 @@ Widget _buildTitleSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
title: '标题',
placement: TDDrawerPlacement.left,
items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),
@@ -176,7 +176,7 @@ Widget _buildTitleSimple(BuildContext context) {
Widget _buildTitleSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带图标抽屉',
isBlock: true,
@@ -187,7 +187,7 @@ Widget _buildTitleSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
title: '标题',
placement: TDDrawerPlacement.left,
items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),
@@ -207,7 +207,7 @@ Widget _buildTitleSimple(BuildContext context) {
Widget _buildBottomSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带底部插槽样式',
isBlock: true,
@@ -218,7 +218,7 @@ Widget _buildBottomSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
title: '标题',
placement: TDDrawerPlacement.left,
items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),
@@ -242,7 +242,7 @@ Widget _buildBottomSimple(BuildContext context) {
Widget _buildBottomSimple(BuildContext context) {
/// 获取navBar尺寸
- var renderBox = navBarkey.currentContext!.findRenderObject() as RenderBox;
+ var renderBox = navBarkey.currentContext?.findRenderObject() as RenderBox?;
return TDButton(
text: '带底部插槽样式',
isBlock: true,
@@ -253,7 +253,7 @@ Widget _buildBottomSimple(BuildContext context) {
TDDrawer(
context,
visible: true,
- drawerTop: renderBox.size.height,
+ drawerTop: renderBox?.size.height,
title: '标题',
placement: TDDrawerPlacement.left,
items: List.generate(10, (index) => TDDrawerItem(title: '菜单${_nums[index]}')).toList(),