Skip to content

Commit c8952c8

Browse files
authored
Merge pull request #43 from ThexXTURBOXx/develop
Update to latest standards
2 parents f4ed3a8 + cc5c375 commit c8952c8

15 files changed

Lines changed: 199 additions & 423 deletions

.github/workflows/dart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
package-analysis:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v6
1313
- uses: axel-op/dart-package-analyzer@v3
1414
# set an id for the current step
1515
id: analysis

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:flutter_lints/flutter.yaml

example/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:flutter_lints/flutter.yaml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
import lldb
6+
7+
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
8+
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
9+
base = frame.register["x0"].GetValueAsAddress()
10+
page_len = frame.register["x1"].GetValueAsUnsigned()
11+
12+
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
13+
# first page to see if handled it correctly. This makes diagnosing
14+
# misconfiguration (e.g. missing breakpoint) easier.
15+
data = bytearray(page_len)
16+
data[0:8] = b'IHELPED!'
17+
18+
error = lldb.SBError()
19+
frame.GetThread().GetProcess().WriteMemory(base, data, error)
20+
if not error.Success():
21+
print(f'Failed to write into {base}[+{page_len}]', error)
22+
return
23+
24+
def __lldb_init_module(debugger: lldb.SBDebugger, _):
25+
target = debugger.GetDummyTarget()
26+
# Caveat: must use BreakpointCreateByRegEx here and not
27+
# BreakpointCreateByName. For some reasons callback function does not
28+
# get carried over from dummy target for the later.
29+
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
30+
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
31+
bp.SetAutoContinue(True)
32+
print("-- LLDB integration loaded --")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
command script import --relative-to-command-file flutter_lldb_helper.py

example/lib/main.dart

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ void main() {
66
}
77

88
class MyExample extends StatelessWidget {
9+
const MyExample({Key? key}) : super(key: key);
10+
911
@override
1012
Widget build(BuildContext context) {
1113
return MaterialApp(
@@ -15,7 +17,9 @@ class MyExample extends StatelessWidget {
1517
}
1618

1719
class Home extends StatelessWidget {
18-
_normalProgress(context) async {
20+
const Home({Key? key}) : super(key: key);
21+
22+
Future<void> _normalProgress(dynamic context) async {
1923
/// Create progress dialog
2024
ProgressDialog pd = ProgressDialog(context: context);
2125

@@ -40,13 +44,13 @@ class Home extends StatelessWidget {
4044
}
4145

4246
/// Shows a progress dialog with a determinate progress bar.
43-
_valuableProgress(context) async {
47+
Future<void> _valuableProgress(dynamic context) async {
4448
ProgressDialog pd = ProgressDialog(context: context);
4549

4650
pd.show(
4751
max: 100,
4852
msg: 'File Downloading...',
49-
progressType: ProgressType.valuable,
53+
progressType: ProgressType.determinate,
5054
);
5155
for (int i = 0; i <= 100; i++) {
5256
pd.update(value: i);
@@ -57,7 +61,7 @@ class Home extends StatelessWidget {
5761

5862
/// Shows a progress dialog that starts with a preparation message,
5963
/// then switches to a downloading message.
60-
_preparingProgress(context) async {
64+
Future<void> _preparingProgress(dynamic context) async {
6165
ProgressDialog pd = ProgressDialog(context: context);
6266

6367
pd.show(
@@ -75,7 +79,7 @@ class Home extends StatelessWidget {
7579
}
7680

7781
/// Shows a customizable progress dialog with a dark theme.
78-
_customProgress(context) async {
82+
Future<void> _customProgress(dynamic context) async {
7983
ProgressDialog pd = ProgressDialog(context: context);
8084
pd.show(
8185
max: 100,
@@ -84,8 +88,8 @@ class Home extends StatelessWidget {
8488
backgroundColor: Color(0xff212121),
8589
progressValueColor: Color(0xff3550B4),
8690
progressBgColor: Colors.white70,
87-
msgColor: Colors.white,
88-
valueColor: Colors.white);
91+
msgStyle: TextStyle(color: Colors.white),
92+
valueStyle: TextStyle(color: Colors.white));
8993
await Future.delayed(Duration(milliseconds: 3000));
9094
for (int i = 0; i <= 100; i++) {
9195
pd.update(value: i, msg: 'File Downloading...');
@@ -95,7 +99,7 @@ class Home extends StatelessWidget {
9599
}
96100

97101
/// Shows a progress dialog that completes with a custom completion widget.
98-
_completedProgress(context) async {
102+
Future<void> _completedProgress(dynamic context) async {
99103
ProgressDialog pd = ProgressDialog(context: context);
100104
pd.show(
101105
max: 100,
@@ -113,7 +117,7 @@ class Home extends StatelessWidget {
113117
}
114118

115119
/// Shows a message-only progress dialog without a progress bar.
116-
_onlyMessageProgress(context) async {
120+
Future<void> _onlyMessageProgress(dynamic context) async {
117121
ProgressDialog pd = ProgressDialog(context: context);
118122
pd.show(
119123
barrierDismissible: true,
@@ -129,7 +133,7 @@ class Home extends StatelessWidget {
129133
}
130134

131135
/// Shows a message-only progress dialog that completes automatically.
132-
_onlyMessageWithCompletionProgress(context) async {
136+
Future<void> _onlyMessageWithCompletionProgress(dynamic context) async {
133137
ProgressDialog pd = ProgressDialog(context: context);
134138
pd.show(
135139
barrierDismissible: true,
@@ -152,65 +156,63 @@ class Home extends StatelessWidget {
152156
@override
153157
Widget build(BuildContext context) {
154158
return Scaffold(
155-
body: Container(
156-
child: Center(
157-
child: Column(
158-
mainAxisAlignment: MainAxisAlignment.center,
159-
children: [
160-
Padding(
161-
padding: const EdgeInsets.all(20.0),
162-
child: Text(
163-
'Sn Progress Example',
164-
style: TextStyle(
165-
fontSize: 30.0,
166-
fontWeight: FontWeight.bold,
167-
),
159+
body: Center(
160+
child: Column(
161+
mainAxisAlignment: MainAxisAlignment.center,
162+
children: [
163+
Padding(
164+
padding: const EdgeInsets.all(20.0),
165+
child: Text(
166+
'Sn Progress Example',
167+
style: TextStyle(
168+
fontSize: 30.0,
169+
fontWeight: FontWeight.bold,
168170
),
169171
),
170-
MaterialButton(
171-
color: Color(0xfff7f7f7),
172-
child: Text('Normal Progress'),
173-
onPressed: () {
174-
_normalProgress(context);
175-
}),
176-
MaterialButton(
177-
color: Color(0xfff7f7f7),
178-
child: Text('Valuable Progress'),
179-
onPressed: () {
180-
_valuableProgress(context);
181-
}),
182-
MaterialButton(
183-
color: Color(0xfff7f7f7),
184-
child: Text('Preparing Progress'),
185-
onPressed: () {
186-
_preparingProgress(context);
187-
}),
188-
MaterialButton(
189-
color: Color(0xfff7f7f7),
190-
child: Text('Custom Progress'),
191-
onPressed: () {
192-
_customProgress(context);
193-
}),
194-
MaterialButton(
195-
color: Color(0xfff7f7f7),
196-
child: Text('Completed Progress'),
197-
onPressed: () {
198-
_completedProgress(context);
199-
}),
200-
MaterialButton(
201-
color: Color(0xfff7f7f7),
202-
child: Text('Message Progress'),
203-
onPressed: () {
204-
_onlyMessageProgress(context);
205-
}),
206-
MaterialButton(
207-
color: Color(0xfff7f7f7),
208-
child: Text('Message Progress With Completed'),
209-
onPressed: () {
210-
_onlyMessageWithCompletionProgress(context);
211-
}),
212-
],
213-
),
172+
),
173+
MaterialButton(
174+
color: Color(0xfff7f7f7),
175+
child: Text('Normal Progress'),
176+
onPressed: () {
177+
_normalProgress(context);
178+
}),
179+
MaterialButton(
180+
color: Color(0xfff7f7f7),
181+
child: Text('Valuable Progress'),
182+
onPressed: () {
183+
_valuableProgress(context);
184+
}),
185+
MaterialButton(
186+
color: Color(0xfff7f7f7),
187+
child: Text('Preparing Progress'),
188+
onPressed: () {
189+
_preparingProgress(context);
190+
}),
191+
MaterialButton(
192+
color: Color(0xfff7f7f7),
193+
child: Text('Custom Progress'),
194+
onPressed: () {
195+
_customProgress(context);
196+
}),
197+
MaterialButton(
198+
color: Color(0xfff7f7f7),
199+
child: Text('Completed Progress'),
200+
onPressed: () {
201+
_completedProgress(context);
202+
}),
203+
MaterialButton(
204+
color: Color(0xfff7f7f7),
205+
child: Text('Message Progress'),
206+
onPressed: () {
207+
_onlyMessageProgress(context);
208+
}),
209+
MaterialButton(
210+
color: Color(0xfff7f7f7),
211+
child: Text('Message Progress With Completed'),
212+
onPressed: () {
213+
_onlyMessageWithCompletionProgress(context);
214+
}),
215+
],
214216
),
215217
),
216218
);

0 commit comments

Comments
 (0)