forked from toly1994328/FlutterUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a0642e
commit 736385b
Showing
15 changed files
with
140 additions
and
43 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
modules/widget_system/widgets/lib/SingleChildRenderObjectWidget/TapRegion/desc_zh-CN.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"id": 280, | ||
"name": "TapRegion", | ||
"localName": "点击范围", | ||
"info": "能够检测内部或外部点击回调的组件,通过 groupId 可以多个区域视为一体。", | ||
"lever": 4, | ||
"family": 2, | ||
"linkIds": [ | ||
146, | ||
54 | ||
], | ||
"nodes": [ | ||
{ | ||
"file": "node1.dart", | ||
"name": "监听点击组件内部和外部", | ||
"desc": [ | ||
"通过 Localizations.localeOf(context) 可以根据上下文获取最近上层的 Localizations 组件存储的 Locale 数据信息。" | ||
] | ||
} | ||
] | ||
} |
45 changes: 45 additions & 0 deletions
45
modules/widget_system/widgets/lib/SingleChildRenderObjectWidget/TapRegion/node1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class TapRegionDemo1 extends StatefulWidget { | ||
const TapRegionDemo1({super.key}); | ||
|
||
@override | ||
State<TapRegionDemo1> createState() => _TapRegionDemo1State(); | ||
} | ||
|
||
class _TapRegionDemo1State extends State<TapRegionDemo1> { | ||
String info = 'Tap any where'; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return TapRegion( | ||
onTapOutside: _onTapOutside, | ||
onTapInside: _onTapInside, | ||
child: Container( | ||
alignment: Alignment.center, | ||
height: 64, | ||
width: 160, | ||
color: isOut ? Colors.grey : Colors.blue, | ||
child: Text( | ||
info, | ||
textAlign: TextAlign.center, | ||
style: const TextStyle(color: Colors.white), | ||
), | ||
), | ||
); | ||
} | ||
|
||
bool get isOut => info.contains('TapOutside'); | ||
|
||
void _onTapOutside(PointerDownEvent event) { | ||
setState(() { | ||
info = "TapOutside:\n${event.position}"; | ||
}); | ||
} | ||
|
||
void _onTapInside(PointerDownEvent event) { | ||
setState(() { | ||
info = "TapInside:\n${event.position}"; | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
modules/widget_system/widgets/lib/StatefulWidget/Localizations/desc_zh-CN.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"id": 290, | ||
"name": "Localizations", | ||
"localName": "国际化", | ||
"info": "为子树节点提供国际化资源,底层依赖 InheritedWidget 实现。 MaterialApp 内部已集成该组件,其 locale 和 delegates 参数最终用于该组件。", | ||
"lever": 4, | ||
"family": 1, | ||
"linkIds": [ | ||
65, | ||
346 | ||
], | ||
"nodes": [ | ||
{ | ||
"file": "node1.dart", | ||
"name": "获取当前语言", | ||
"desc": [ | ||
"通过 Localizations.localeOf(context) 可以根据上下文获取最近上层的 Localizations 组件存储的 Locale 数据信息。" | ||
] | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
modules/widget_system/widgets/lib/StatefulWidget/Localizations/node1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class LocalizationsDemo1 extends StatelessWidget { | ||
const LocalizationsDemo1({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Locale locale = Localizations.localeOf(context); | ||
return Text('Locale: ${locale.toString()}'); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
modules/widget_system/widgets/lib/exp/MultiChildRenderObjectWidget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
library render_object_widget; | ||
|
||
|
||
export '../MultiChildRenderObjectWidget/Flex/node_01.dart'; | ||
export '../MultiChildRenderObjectWidget/Flex/node_02.dart'; | ||
export '../MultiChildRenderObjectWidget/Flex/node_03.dart'; | ||
export '../MultiChildRenderObjectWidget/Flex/node_04.dart'; | ||
export '../MultiChildRenderObjectWidget/Flex/node_05.dart'; | ||
|
||
export '../MultiChildRenderObjectWidget/Flow/node_01.dart'; | ||
export '../MultiChildRenderObjectWidget/Flow/node_02.dart'; | ||
export '../MultiChildRenderObjectWidget/RichText/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/RichText/node2_widget.dart'; | ||
export '../MultiChildRenderObjectWidget/Stack/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/Stack/node2_positioned.dart'; | ||
export '../MultiChildRenderObjectWidget/Wrap/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/Wrap/node2_alignment.dart'; | ||
export '../MultiChildRenderObjectWidget/Wrap/node3_crossAxisAlignment.dart'; | ||
export '../MultiChildRenderObjectWidget/Wrap/node4_textDirection.dart'; | ||
export '../MultiChildRenderObjectWidget/Wrap/node5_verticalDirection.dart'; | ||
export '../MultiChildRenderObjectWidget/Column/node_01.dart'; | ||
export '../MultiChildRenderObjectWidget/IndexedStack/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/Row/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/CustomMultiChildLayout/node_01.dart'; | ||
export '../MultiChildRenderObjectWidget/Viewport/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/ListBody/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/ShrinkWrappingViewport/node1_base.dart'; | ||
export '../MultiChildRenderObjectWidget/NestedScrollViewViewport/node1_base.dart'; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
library widgets; | ||
|
||
export 'node_display_map.dart'; | ||
|
||
export 'exp/other_unit.dart'; | ||
export 'exp/proxy_unit.dart'; | ||
export 'exp/render_object_unit.dart' hide Box50,CornerCustomMultiChildLayout,CornerType; | ||
export 'exp/sliver_unit.dart'; | ||
export 'exp/stateful_unit.dart' hide ListModel; | ||
export 'exp/stateless_unit.dart'; |