Skip to content

Commit

Permalink
Re-organized & refactored example app source
Browse files Browse the repository at this point in the history
Improved CONTRIBUTING
Minor improvements to `FMTCImageProvider`
  • Loading branch information
JaffaKetchup committed Sep 9, 2024
1 parent a77390f commit 2665573
Show file tree
Hide file tree
Showing 51 changed files with 228 additions and 240 deletions.
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

## Reporting A Bug

FMTC is a large, platform-dependent package, and there's only one person running manual tests on it before releases, so there's a decent chance that a bug you've found is actually a bug. Reporting it is always appreciated!
I try to test FMTC on as many platforms as I have access to, using a combination of automated tests and manual tests through the example application. However, I only have access to Android and Windows devices. Due to the number of platform-dependent plugins this package uses, bugs are often only present on one platform, which is often iOS. However, they can of course occur on any platform if I've missed one. Reporting any bugs you find is always appreciated!

Before reporting a bug, please:

* Check if there is already an open or closed issue that is similar to yours
* Ensure that your Flutter environment is correctly installed & set-up
* Ensure that this package, 'flutter_map', and any modules are correctly installed & set-up
* Ensure that Flutter, this package, 'flutter_map', and any modules are correctly installed & set-up
* Follow the bug reporting issue template

## Contributing Code

Contributors are always welcome, and support is always greatly appreciated! Before opening a Pull Request, however, please open a feature request or bug report to link the PR to.

Please note that all contributions may be dually licensed under an alternative proprietary license on a case-by-case basis, which grants no extra rights to contributors.

When submitting code, please:

* Keep code concise and in a similar style to surrounding code
* Document all public APIs in detail and with correct grammar
* Document all new public APIs
* Use the included linting rules
* Update the example application to appropriately consume any public API changes
* Avoid incrementing this package's version number or changelog
12 changes: 6 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'src/screens/configure_download/configure_download.dart';
import 'src/screens/configure_download/state/configure_download_provider.dart';
import 'src/screens/download/download.dart';
import 'src/screens/home/config_view/panels/stores/state/export_selection_provider.dart';
import 'src/screens/home/home.dart';
import 'src/screens/home/map_view/state/region_selection_provider.dart';
import 'src/screens/import/import.dart';
import 'src/screens/initialisation_error/initialisation_error.dart';
import 'src/screens/main/main.dart';
import 'src/screens/main/map_view/state/region_selection_provider.dart';
import 'src/screens/main/secondary_view/contents/home/components/stores/state/export_selection_provider.dart';
import 'src/screens/store_editor/store_editor.dart';
import 'src/shared/misc/shared_preferences.dart';
import 'src/shared/state/general_provider.dart';
Expand Down Expand Up @@ -43,8 +43,8 @@ class _AppContainer extends StatelessWidget {
Widget Function(BuildContext)? std,
PageRoute Function(BuildContext, RouteSettings)? custom,
})>{
HomeScreen.route: (
std: (BuildContext context) => const HomeScreen(),
MainScreen.route: (
std: (BuildContext context) => const MainScreen(),
custom: null,
),
StoreEditorPopup.route: (
Expand Down Expand Up @@ -126,7 +126,7 @@ class _AppContainer extends StatelessWidget {
title: 'FMTC Demo',
restorationScopeId: 'FMTC Demo',
theme: themeData,
initialRoute: HomeScreen.route,
initialRoute: MainScreen.route,
onGenerateRoute: (settings) {
final route = _routes[settings.name]!;
if (route.custom != null) return route.custom!(context, settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../shared/misc/exts/interleave.dart';
import '../home/map_view/state/region_selection_provider.dart';
import '../main/map_view/state/region_selection_provider.dart';
import 'components/numerical_input_row.dart';
import 'components/options_pane.dart';
import 'components/region_information.dart';
Expand Down
81 changes: 0 additions & 81 deletions example/lib/src/screens/home/config_view/forms/side/side.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import 'package:flutter/material.dart';

import 'config_view/forms/bottom_sheet/bottom_sheet.dart';
import 'config_view/forms/side/side.dart';
import 'map_view/bottom_sheet_wrapper.dart';
import 'map_view/components/bottom_sheet_wrapper.dart';
import 'map_view/map_view.dart';
import 'secondary_view/layouts/bottom_sheet/bottom_sheet.dart';
import 'secondary_view/layouts/side/side.dart';

class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
class MainScreen extends StatefulWidget {
const MainScreen({super.key});

static const String route = '/';

@override
State<HomeScreen> createState() => _HomeScreenState();
State<MainScreen> createState() => _MainScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
class _MainScreenState extends State<MainScreen> {
final bottomSheetOuterController = DraggableScrollableController();

int selectedTab = 0;
Expand All @@ -39,8 +39,10 @@ class _HomeScreenState extends State<HomeScreen> {
mode: mapMode,
layoutDirection: layoutDirection,
),
bottomSheet:
ConfigViewBottomSheet(controller: bottomSheetOuterController),
bottomSheet: SecondaryViewBottomSheet(
selectedTab: selectedTab,
controller: bottomSheetOuterController,
),
bottomNavigationBar: NavigationBar(
selectedIndex: selectedTab,
destinations: const [
Expand All @@ -61,7 +63,8 @@ class _HomeScreenState extends State<HomeScreen> {
),
],
onDestinationSelected: (i) {
if (i == 0) {
setState(() => selectedTab = i);
/*if (i == 0) {
final requiresExpanding =
bottomSheetOuterController.size < 0.3;
Expand Down Expand Up @@ -96,24 +99,15 @@ class _HomeScreenState extends State<HomeScreen> {
curve: Curves.easeIn,
),
);
}
}*/
},
),
);
}

return TweenAnimationBuilder(
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
tween: Tween<double>(begin: 0, end: selectedTab == 0 ? 0 : 1),
builder: (context, colorAnimation, child) => Scaffold(
backgroundColor: ColorTween(
begin: Theme.of(context).colorScheme.surfaceContainer,
end: Theme.of(context).scaffoldBackgroundColor,
).lerp(colorAnimation),
body: child,
),
child: LayoutBuilder(
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
body: LayoutBuilder(
builder: (context, constraints) => Row(
children: [
NavigationRail(
Expand Down Expand Up @@ -151,7 +145,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
onDestinationSelected: (i) => setState(() => selectedTab = i),
),
ConfigViewSide(
SecondaryViewSide(
selectedTab: selectedTab,
constraints: constraints,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import '../../../shared/components/delayed_frame_attached_dependent_builder.dart';
import '../../../../shared/components/delayed_frame_attached_dependent_builder.dart';

import 'map_view.dart';
import '../map_view.dart';

/// Wraps [MapView] with the necessary widgets to keep the map contents clear
/// of the bottom sheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../../../../shared/state/general_provider.dart';
import '../../../../../../../../shared/state/general_provider.dart';

class ConfigPanelBehaviour extends StatelessWidget {
const ConfigPanelBehaviour({
class LoadingBehaviourSelector extends StatelessWidget {
const LoadingBehaviourSelector({
super.key,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../../../shared/components/url_selector.dart';
import '../../../../../shared/state/general_provider.dart';
import '../../forms/bottom_sheet/components/scrollable_provider.dart';
import '../behaviour/behaviour.dart';
import '../../../../../../../shared/components/url_selector.dart';
import '../../../../../../../shared/state/general_provider.dart';
import '../../../../layouts/bottom_sheet/components/scrollable_provider.dart';
import 'components/loading_behaviour_selector.dart';

class ConfigPanelMap extends StatefulWidget {
const ConfigPanelMap({
class MapConfigurator extends StatefulWidget {
const MapConfigurator({
super.key,
this.bottomSheetOuterController,
});

final DraggableScrollableController? bottomSheetOuterController;

@override
State<ConfigPanelMap> createState() => _ConfigPanelMapState();
State<MapConfigurator> createState() => _MapConfiguratorState();
}

class _ConfigPanelMapState extends State<ConfigPanelMap> {
class _MapConfiguratorState extends State<MapConfigurator> {
double? _previousBottomSheetOuterHeight;
double? _previousBottomSheetInnerHeight;

@override
Widget build(BuildContext context) => Column(
mainAxisSize: MainAxisSize.min,
children: [
const ConfigPanelBehaviour(),
const SizedBox(height: 8),
URLSelector(
initialValue: context.select<GeneralProvider, String>(
(provider) => provider.urlTemplate,
Expand Down Expand Up @@ -74,6 +72,8 @@ class _ConfigPanelMapState extends State<ConfigPanelMap> {
}
: null,
),
const SizedBox(height: 12),
const LoadingBehaviourSelector(),
const SizedBox(height: 6),
Selector<GeneralProvider, bool>(
selector: (context, provider) => provider.displayDebugOverlay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../shared/state/general_provider.dart';
import '../../../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../../../shared/state/general_provider.dart';

class ColumnHeadersAndInheritableSettings extends StatelessWidget {
const ColumnHeadersAndInheritableSettings({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

import '../../../../../import/import.dart';
import '../../../../../store_editor/store_editor.dart';
import '../../../../../../../import/import.dart';
import '../../../../../../../store_editor/store_editor.dart';

class NewStoreButton extends StatelessWidget {
const NewStoreButton({super.key});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

import '../../../../../import/import.dart';
import '../../../../../store_editor/store_editor.dart';
import '../../../../../../../import/import.dart';
import '../../../../../../../store_editor/store_editor.dart';

class NoStores extends StatelessWidget {
const NoStores({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../../../shared/state/general_provider.dart';
import '../../../../../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../../../../../shared/state/general_provider.dart';

part 'checkbox.dart';
part 'dropdown.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../../../../../../shared/misc/exts/size_formatter.dart';
import '../../../../../../../shared/misc/store_metadata_keys.dart';
import '../../../../../../../shared/state/general_provider.dart';
import '../../../../../../store_editor/store_editor.dart';
import '../../../../../../../../../shared/misc/exts/size_formatter.dart';
import '../../../../../../../../../shared/misc/store_metadata_keys.dart';
import '../../../../../../../../../shared/state/general_provider.dart';
import '../../../../../../../../store_editor/store_editor.dart';
import '../../state/export_selection_provider.dart';
import 'browse_store_strategy_selector/browse_store_strategy_selector.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../../shared/state/general_provider.dart';
import '../../../../../../../../../shared/misc/internal_store_read_write_behaviour.dart';
import '../../../../../../../../../shared/state/general_provider.dart';
import 'browse_store_strategy_selector/browse_store_strategy_selector.dart';

class UnspecifiedTile extends StatefulWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:provider/provider.dart';

import '../../../../../shared/misc/exts/size_formatter.dart';
import '../../../../../../../shared/misc/exts/size_formatter.dart';
import 'components/column_headers_and_inheritable_settings.dart';
import 'components/export_stores/button.dart';
import 'components/new_store_button.dart';
Expand Down
Loading

0 comments on commit 2665573

Please sign in to comment.