Skip to content

Commit

Permalink
Finished example app contents
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup committed Jan 11, 2025
1 parent 190b90b commit a07d31a
Show file tree
Hide file tree
Showing 12 changed files with 410 additions and 182 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pubspec.lock
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/app/.cxx

# iOS/XCode related
**/ios/**/*.mode1v3
Expand Down
60 changes: 29 additions & 31 deletions example/lib/src/screens/main/layouts/vertical.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,37 @@ class _VerticalLayout extends StatelessWidget {
controller: _bottomSheetOuterController,
),
floatingActionButton: selectedTab == 1 &&
context
.watch<RegionSelectionProvider>()
.constructedRegions
.isNotEmpty
context.select<RegionSelectionProvider, bool>(
(provider) =>
provider.constructedRegions.isNotEmpty &&
!provider.isDownloadSetupPanelVisible,
)
? DelayedControllerAttachmentBuilder(
listenable: _bottomSheetOuterController,
builder: (context, _) => AnimatedBuilder(
animation: _bottomSheetOuterController,
builder: (context, _) {
final pixels = _bottomSheetOuterController.isAttached
? _bottomSheetOuterController.pixels
: 0;
return FloatingActionButton(
onPressed: () async {
await _bottomSheetOuterController.animateTo(
2 / 3,
duration: const Duration(milliseconds: 250),
curve: Curves.easeOut,
);
if (!context.mounted) return;
prepareDownloadConfigView(
context,
shouldShowConfig: pixels > 33,
);
},
tooltip:
pixels <= 33 ? 'Show regions' : 'Configure download',
child: pixels <= 33
? const Icon(Icons.library_add_check)
: const Icon(Icons.tune),
);
},
),
builder: (context, _) {
final pixels = _bottomSheetOuterController.isAttached
? _bottomSheetOuterController.pixels
: 0;
return FloatingActionButton(
onPressed: () async {
await _bottomSheetOuterController.animateTo(
2 / 3,
duration: const Duration(milliseconds: 250),
curve: Curves.easeOut,
);
if (!context.mounted) return;
prepareDownloadConfigView(
context,
shouldShowConfig: pixels > 33,
);
},
tooltip:
pixels <= 33 ? 'Show regions' : 'Configure download',
child: pixels <= 33
? const Icon(Icons.library_add_check)
: const Icon(Icons.tune),
);
},
)
: null,
bottomNavigationBar: NavigationBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ class AdditionalOverlay extends StatelessWidget {
listenable: bottomSheetOuterController,
builder: (context, child) {
if (!bottomSheetOuterController.isAttached) return child!;
return AnimatedBuilder(
animation: bottomSheetOuterController,
builder: (context, child) => _HeightZero(
useChildHeight: showShapeSelector &&
bottomSheetOuterController.pixels <= 33,
child: child!,
),
child: child,
return _HeightZero(
useChildHeight: showShapeSelector &&
bottomSheetOuterController.pixels <= 33,
child: child!,
);
},
child: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,122 +43,119 @@ class _ConfigOptionsState extends State<ConfigOptions> {
final fromRecovery = context
.select<DownloadConfigurationProvider, int?>((p) => p.fromRecovery);

return SingleChildScrollView(
child: Column(
children: [
StoreSelector(
storeName: storeName,
onStoreNameSelected: (storeName) => context
.read<DownloadConfigurationProvider>()
.selectedStoreName = storeName,
enabled: fromRecovery == null,
),
const Divider(height: 24),
Row(
children: [
const Tooltip(message: 'Zoom Levels', child: Icon(Icons.search)),
const SizedBox(width: 8),
Expanded(
child: RangeSlider(
values: RangeValues(minZoom.toDouble(), maxZoom.toDouble()),
max: 20,
divisions: 20,
onChanged: fromRecovery != null
? null
: (r) => context.read<DownloadConfigurationProvider>()
..minZoom = r.start.toInt()
..maxZoom = r.end.toInt(),
),
return Column(
children: [
StoreSelector(
storeName: storeName,
onStoreNameSelected: (storeName) => context
.read<DownloadConfigurationProvider>()
.selectedStoreName = storeName,
enabled: fromRecovery == null,
),
const Divider(height: 24),
Row(
children: [
const Tooltip(message: 'Zoom Levels', child: Icon(Icons.search)),
const SizedBox(width: 8),
Expanded(
child: RangeSlider(
values: RangeValues(minZoom.toDouble(), maxZoom.toDouble()),
max: 20,
divisions: 20,
onChanged: fromRecovery != null
? null
: (r) => context.read<DownloadConfigurationProvider>()
..minZoom = r.start.toInt()
..maxZoom = r.end.toInt(),
),
Text(
'${minZoom.toString().padLeft(2, '0')} - '
'${maxZoom.toString().padLeft(2, '0')}',
),
Text(
'${minZoom.toString().padLeft(2, '0')} - '
'${maxZoom.toString().padLeft(2, '0')}',
),
],
),
const Divider(height: 24),
_SliderOption(
icon: const Icon(Icons.call_split),
tooltipMessage: 'Parallel Threads',
descriptor: 'threads',
value: parallelThreads,
min: 1,
max: 10,
onChanged: (v) =>
context.read<DownloadConfigurationProvider>().parallelThreads = v,
),
const SizedBox(height: 8),
_SliderOption(
icon: const Icon(Icons.speed),
tooltipMessage: 'Rate Limit',
descriptor: 'tps max',
value: rateLimit,
min: 1,
max: 200,
onChanged: (v) =>
context.read<DownloadConfigurationProvider>().rateLimit = v,
),
const SizedBox(height: 8),
Row(
children: [
const Tooltip(
message: 'Max Buffer Length',
child: Icon(Icons.memory),
),
const SizedBox(width: 6),
Expanded(
child: Slider(
value: maxBufferLength.toDouble(),
max: 1000,
divisions: 1000,
onChanged: (r) => context
.read<DownloadConfigurationProvider>()
.maxBufferLength = r.toInt(),
),
],
),
const Divider(height: 24),
_SliderOption(
icon: const Icon(Icons.call_split),
tooltipMessage: 'Parallel Threads',
descriptor: 'threads',
value: parallelThreads,
min: 1,
max: 10,
onChanged: (v) => context
.read<DownloadConfigurationProvider>()
.parallelThreads = v,
),
const SizedBox(height: 8),
_SliderOption(
icon: const Icon(Icons.speed),
tooltipMessage: 'Rate Limit',
descriptor: 'tps max',
value: rateLimit,
min: 1,
max: 200,
onChanged: (v) =>
context.read<DownloadConfigurationProvider>().rateLimit = v,
),
const SizedBox(height: 8),
Row(
children: [
const Tooltip(
message: 'Max Buffer Length',
child: Icon(Icons.memory),
),
SizedBox(
width: 71,
child: Text(
maxBufferLength == 0 ? 'Disabled' : '$maxBufferLength tiles',
textAlign: TextAlign.end,
),
const SizedBox(width: 6),
Expanded(
child: Slider(
value: maxBufferLength.toDouble(),
max: 1000,
divisions: 1000,
onChanged: (r) => context
.read<DownloadConfigurationProvider>()
.maxBufferLength = r.toInt(),
),
),
SizedBox(
width: 71,
child: Text(
maxBufferLength == 0 ? 'Disabled' : '$maxBufferLength tiles',
textAlign: TextAlign.end,
),
),
],
),
const Divider(height: 24),
_ToggleOption(
icon: const Icon(Icons.file_copy),
title: 'Skip Existing Tiles',
description: "Don't attempt tiles that are already cached",
value: skipExistingTiles,
onChanged: (v) => context
.read<DownloadConfigurationProvider>()
.skipExistingTiles = v,
),
const SizedBox(height: 8),
_ToggleOption(
icon: const Icon(Icons.waves),
title: 'Skip Sea Tiles',
description:
"Don't cache tiles with sea/ocean fill as the only visible "
'element',
value: skipSeaTiles,
onChanged: (v) =>
context.read<DownloadConfigurationProvider>().skipSeaTiles = v,
),
const SizedBox(height: 8),
_ToggleOption(
icon: const Icon(Icons.plus_one),
title: 'Retry Failed Tiles',
description: 'Retries tiles that failed their HTTP request once',
value: retryFailedRequestTiles,
onChanged: (v) => context
.read<DownloadConfigurationProvider>()
.retryFailedRequestTiles = v,
),
],
),
),
],
),
const Divider(height: 24),
_ToggleOption(
icon: const Icon(Icons.file_copy),
title: 'Skip Existing Tiles',
description: "Don't attempt tiles that are already cached",
value: skipExistingTiles,
onChanged: (v) => context
.read<DownloadConfigurationProvider>()
.skipExistingTiles = v,
),
const SizedBox(height: 8),
_ToggleOption(
icon: const Icon(Icons.waves),
title: 'Skip Sea Tiles',
description:
"Don't cache tiles with sea/ocean fill as the only visible "
'element',
value: skipSeaTiles,
onChanged: (v) =>
context.read<DownloadConfigurationProvider>().skipSeaTiles = v,
),
const SizedBox(height: 8),
_ToggleOption(
icon: const Icon(Icons.plus_one),
title: 'Retry Failed Tiles',
description: 'Retries tiles that failed their HTTP request once',
value: retryFailedRequestTiles,
onChanged: (v) => context
.read<DownloadConfigurationProvider>()
.retryFailedRequestTiles = v,
),
],
);
}
}
Loading

0 comments on commit a07d31a

Please sign in to comment.