-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#70 use different main files for configuration
- Loading branch information
Showing
9 changed files
with
87 additions
and
32 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
.idea/runConfigurations/Run_Flutter.xml → .../runConfigurations/Run_Flutter__prod_.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 +1,35 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:graphql_flutter/graphql_flutter.dart'; | ||
|
||
import 'home/home_page.dart'; | ||
import 'configuration.dart'; | ||
|
||
class App extends StatelessWidget { | ||
const App({Key key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Digitale Ehrenamtskarte', | ||
theme: ThemeData( | ||
primarySwatch: Colors.blue, | ||
brightness: Brightness.light, | ||
visualDensity: VisualDensity.adaptivePlatformDensity), | ||
home: HomePage(title: "Digitale Ehrenamtskarte")); | ||
final config = Configuration.of(context); | ||
final client = ValueNotifier( | ||
GraphQLClient( | ||
cache: InMemoryCache(), | ||
link: Link.from([ | ||
HttpLink( | ||
uri: config.graphqlUrl, | ||
) | ||
]), | ||
), | ||
); | ||
final theme = ThemeData( | ||
primarySwatch: Colors.blue, | ||
brightness: Brightness.light, | ||
visualDensity: VisualDensity.adaptivePlatformDensity); | ||
return GraphQLProvider( | ||
child: CacheProvider( | ||
child: MaterialApp( | ||
title: 'Digitale Ehrenamtskarte', | ||
theme: theme, | ||
home: HomePage(title: "Digitale Ehrenamtskarte"))), | ||
client: client); | ||
} | ||
} |
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,23 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class Configuration extends InheritedWidget { | ||
final String mapStyleUrl; | ||
final String graphqlUrl; | ||
|
||
const Configuration({ | ||
Key key, | ||
@required this.mapStyleUrl, | ||
@required this.graphqlUrl, | ||
@required Widget child, | ||
}) : assert(mapStyleUrl != null), | ||
assert(graphqlUrl != null), | ||
super(key: key, child: child); | ||
|
||
@override | ||
bool updateShouldNotify(covariant Configuration oldWidget) => | ||
mapStyleUrl != oldWidget.mapStyleUrl || | ||
graphqlUrl != oldWidget.graphqlUrl; | ||
|
||
static Configuration of(BuildContext context) => | ||
context.dependOnInheritedWidgetOfExactType<Configuration>(); | ||
} |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import 'package:ehrenamtskarte/configuration.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'app.dart'; | ||
|
||
Future<void> main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
runApp(Configuration( | ||
mapStyleUrl: "https://vector.ehrenamtskarte.app/style.json", | ||
graphqlUrl: "http://10.0.2.2:7000", | ||
child: App())); | ||
} |
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,12 @@ | ||
import 'package:ehrenamtskarte/configuration.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'app.dart'; | ||
|
||
Future<void> main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
runApp(Configuration( | ||
mapStyleUrl: "https://vector.ehrenamtskarte.app/style.json", | ||
graphqlUrl: "https://api.ehrenamtskarte.app", | ||
child: App())); | ||
} |
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