Skip to content

Commit 2ebdd6d

Browse files
committed
refactor(ui): reverse log order to show newest first
1 parent e0e45c2 commit 2ebdd6d

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

examples/build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ LogView Features:
952952
- Fixed 100dp height
953953
- Default expanded
954954
- Trash icon button (Icons.delete) for clearing logs, not a text button
955-
- Auto-scroll to newest using ScrollController
955+
- Reverse order: newest logs at top
956956
957957
Appium Semantic Labels:
958958
| Label | Description |

examples/demo/lib/screens/home_screen.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@ class _HomeScreenState extends State<HomeScreen> {
9999
child: ListView(
100100
padding: const EdgeInsets.only(bottom: 24),
101101
children: [
102-
AppSection(
103-
onInfoTap: () => _showTooltipDialog(context, 'app'),
104-
),
105-
UserSection(
106-
onInfoTap: () => _showTooltipDialog(context, 'user'),
107-
),
102+
const AppSection(),
103+
const UserSection(),
108104
PushSection(
109105
onInfoTap: () => _showTooltipDialog(context, 'push'),
110106
),

examples/demo/lib/widgets/log_view.dart

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ class _LogViewState extends State<LogView> {
2929

3030
void _onLogChanged() {
3131
setState(() {});
32-
WidgetsBinding.instance.addPostFrameCallback((_) {
33-
if (_scrollController.hasClients) {
34-
_scrollController.animateTo(
35-
_scrollController.position.maxScrollExtent,
36-
duration: const Duration(milliseconds: 100),
37-
curve: Curves.easeOut,
38-
);
39-
}
40-
});
4132
}
4233

4334
Color _levelColor(LogLevel level) {
@@ -118,7 +109,7 @@ class _LogViewState extends State<LogView> {
118109
_expanded
119110
? Icons.expand_less
120111
: Icons.expand_more,
121-
size: 20,
112+
size: 18,
122113
color: AppColors.osGrey500,
123114
),
124115
],
@@ -145,10 +136,11 @@ class _LogViewState extends State<LogView> {
145136
)
146137
: ListView.builder(
147138
controller: _scrollController,
139+
reverse: true,
148140
itemCount: logs.length,
149141
padding: const EdgeInsets.symmetric(horizontal: 12),
150142
itemBuilder: (context, index) {
151-
final entry = logs[index];
143+
final entry = logs[logs.length - 1 - index];
152144
return Semantics(
153145
label: 'log_entry_$index',
154146
child: Padding(

0 commit comments

Comments
 (0)