reinit as serverpod project
75
wien_talks/.github/workflows/deployment-aws.yml
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
name: Deploy to AWS
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ deployment-aws-production, deployment-aws-staging ]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: 'Target'
|
||||||
|
required: true
|
||||||
|
default: 'production'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 'staging'
|
||||||
|
- 'production'
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy to AWS
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setup Dart SDK
|
||||||
|
uses: dart-lang/setup-dart@v1.6.5
|
||||||
|
with:
|
||||||
|
sdk: 3.5
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: us-west-2
|
||||||
|
|
||||||
|
- name: Create passwords file
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
SERVERPOD_PASSWORDS: ${{ secrets.SERVERPOD_PASSWORDS }}
|
||||||
|
run: |
|
||||||
|
pwd
|
||||||
|
echo "$SERVERPOD_PASSWORDS" > config/passwords.yaml
|
||||||
|
ls config/
|
||||||
|
|
||||||
|
- name: Get Dart packages
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: dart pub get
|
||||||
|
|
||||||
|
- name: Compile server
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: dart compile kernel bin/main.dart
|
||||||
|
|
||||||
|
- name: Create CodeDeploy Deployment
|
||||||
|
id: deploy
|
||||||
|
env:
|
||||||
|
PROJECT_NAME: wien_talks
|
||||||
|
AWS_NAME: wien-talks
|
||||||
|
DEPLOYMENT_BUCKET: wien-talks-deployment-6559518
|
||||||
|
TARGET: ${{ github.event.inputs.target }}
|
||||||
|
run: |
|
||||||
|
# Deploy server to AWS
|
||||||
|
TARGET="${TARGET:=${GITHUB_REF##*-}}"
|
||||||
|
echo "Deploying to target: $TARGET"
|
||||||
|
mkdir -p vendor
|
||||||
|
cp "${PROJECT_NAME}_server/deploy/aws/scripts/appspec.yml" appspec.yml
|
||||||
|
zip -r deployment.zip .
|
||||||
|
aws s3 cp deployment.zip "s3://${DEPLOYMENT_BUCKET}/deployment.zip"
|
||||||
|
aws deploy create-deployment \
|
||||||
|
--application-name "${AWS_NAME}-app" \
|
||||||
|
--deployment-group-name "${AWS_NAME}-${TARGET}-group" \
|
||||||
|
--deployment-config-name CodeDeployDefault.OneAtATime \
|
||||||
|
--s3-location "bucket=${DEPLOYMENT_BUCKET},key=deployment.zip,bundleType=zip"
|
||||||
99
wien_talks/.github/workflows/deployment-gcp.yml
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
name: Deploy to GCP
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ deployment-gcp-production, deployment-gcp-staging ]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: 'Target'
|
||||||
|
required: true
|
||||||
|
default: 'production'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 'staging'
|
||||||
|
- 'production'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# TODO: Update with your Google Cloud project id. If you have changed the
|
||||||
|
# region and zone in your Terraform configuration, you will need to change
|
||||||
|
# it here too.
|
||||||
|
PROJECT: "<PROJECT ID>"
|
||||||
|
REGION: us-central1
|
||||||
|
ZONE: us-central1-c
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy to Google Cloud Run
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setting Target Mode from Input
|
||||||
|
if: ${{ github.event.inputs.target != '' }}
|
||||||
|
run: echo "TARGET=${{ github.event.inputs.target }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Setting Target mode based on branch
|
||||||
|
if: ${{ github.event.inputs.target == '' }}
|
||||||
|
run: echo "TARGET=${GITHUB_REF##*-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set repository
|
||||||
|
run: echo "REPOSITORY=serverpod-${{ env.TARGET }}-container" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set Image Name
|
||||||
|
run: echo "IMAGE_NAME=serverpod" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set Service Name
|
||||||
|
run: echo "SERVICE_NAME=$(echo $IMAGE_NAME | sed 's/[^a-zA-Z0-9]/-/g')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: echo $SERVICE_NAME
|
||||||
|
|
||||||
|
|
||||||
|
- id: "auth"
|
||||||
|
name: "Authenticate to Google Cloud"
|
||||||
|
uses: "google-github-actions/auth@v1"
|
||||||
|
with:
|
||||||
|
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"
|
||||||
|
|
||||||
|
- name: Create passwords file
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
SERVERPOD_PASSWORDS: ${{ secrets.SERVERPOD_PASSWORDS }}
|
||||||
|
run: |
|
||||||
|
pwd
|
||||||
|
echo "$SERVERPOD_PASSWORDS" > config/passwords.yaml
|
||||||
|
ls config/
|
||||||
|
|
||||||
|
- name: Configure Docker
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev
|
||||||
|
|
||||||
|
- name: Build the Docker image
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: "docker build -t $IMAGE_NAME ."
|
||||||
|
|
||||||
|
- name: Tag the Docker image
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: docker tag $IMAGE_NAME ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT }}/${{ env.REPOSITORY }}/$IMAGE_NAME
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
working-directory: wien_talks_server
|
||||||
|
run: docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT }}/${{ env.REPOSITORY }}/$IMAGE_NAME
|
||||||
|
|
||||||
|
# Uncomment the following code to automatically restart the servers in the
|
||||||
|
# instance group when you push a new version of your code. Before doing
|
||||||
|
# this, make sure that you have successfully deployed a first version.
|
||||||
|
#
|
||||||
|
# - name: Restart servers in instance group
|
||||||
|
# run: |
|
||||||
|
# gcloud compute instance-groups managed rolling-action replace serverpod-${{ env.TARGET }}-group \
|
||||||
|
# --project=${{ env.PROJECT }} \
|
||||||
|
# --replacement-method='substitute' \
|
||||||
|
# --max-surge=1 \
|
||||||
|
# --max-unavailable=1 \
|
||||||
|
# --zone=${{ env.ZONE }}
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
# wien_talks
|
|
||||||
|
|
||||||
A new Flutter project.
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
|
||||||
|
|
||||||
A few resources to get you started if this is your first Flutter project:
|
|
||||||
|
|
||||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
|
||||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
|
||||||
|
|
||||||
For help getting started with Flutter development, view the
|
|
||||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
|
||||||
samples, guidance on mobile development, and a full API reference.
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
runApp(const MyApp());
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
|
||||||
const MyApp({super.key});
|
|
||||||
|
|
||||||
// This widget is the root of your application.
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return MaterialApp(
|
|
||||||
title: 'Flutter Demo',
|
|
||||||
theme: ThemeData(
|
|
||||||
// This is the theme of your application.
|
|
||||||
//
|
|
||||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
|
||||||
// the application has a purple toolbar. Then, without quitting the app,
|
|
||||||
// try changing the seedColor in the colorScheme below to Colors.green
|
|
||||||
// and then invoke "hot reload" (save your changes or press the "hot
|
|
||||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
|
||||||
// the command line to start the app).
|
|
||||||
//
|
|
||||||
// Notice that the counter didn't reset back to zero; the application
|
|
||||||
// state is not lost during the reload. To reset the state, use hot
|
|
||||||
// restart instead.
|
|
||||||
//
|
|
||||||
// This works for code too, not just values: Most code changes can be
|
|
||||||
// tested with just a hot reload.
|
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
||||||
),
|
|
||||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
|
||||||
const MyHomePage({super.key, required this.title});
|
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
|
||||||
// how it looks.
|
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
|
||||||
// used by the build method of the State. Fields in a Widget subclass are
|
|
||||||
// always marked "final".
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MyHomePage> createState() => _MyHomePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
|
||||||
int _counter = 0;
|
|
||||||
|
|
||||||
void _incrementCounter() {
|
|
||||||
setState(() {
|
|
||||||
// This call to setState tells the Flutter framework that something has
|
|
||||||
// changed in this State, which causes it to rerun the build method below
|
|
||||||
// so that the display can reflect the updated values. If we changed
|
|
||||||
// _counter without calling setState(), then the build method would not be
|
|
||||||
// called again, and so nothing would appear to happen.
|
|
||||||
_counter++;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// This method is rerun every time setState is called, for instance as done
|
|
||||||
// by the _incrementCounter method above.
|
|
||||||
//
|
|
||||||
// The Flutter framework has been optimized to make rerunning build methods
|
|
||||||
// fast, so that you can just rebuild anything that needs updating rather
|
|
||||||
// than having to individually change instances of widgets.
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
// TRY THIS: Try changing the color here to a specific color (to
|
|
||||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
|
||||||
// change color while the other colors stay the same.
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
|
||||||
// the App.build method, and use it to set our appbar title.
|
|
||||||
title: Text(widget.title),
|
|
||||||
),
|
|
||||||
body: Center(
|
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
|
||||||
// in the middle of the parent.
|
|
||||||
child: Column(
|
|
||||||
// Column is also a layout widget. It takes a list of children and
|
|
||||||
// arranges them vertically. By default, it sizes itself to fit its
|
|
||||||
// children horizontally, and tries to be as tall as its parent.
|
|
||||||
//
|
|
||||||
// Column has various properties to control how it sizes itself and
|
|
||||||
// how it positions its children. Here we use mainAxisAlignment to
|
|
||||||
// center the children vertically; the main axis here is the vertical
|
|
||||||
// axis because Columns are vertical (the cross axis would be
|
|
||||||
// horizontal).
|
|
||||||
//
|
|
||||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
|
||||||
// action in the IDE, or press "p" in the console), to see the
|
|
||||||
// wireframe for each widget.
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
const Text('You have pushed the button this many times:'),
|
|
||||||
Text(
|
|
||||||
'$_counter',
|
|
||||||
style: Theme.of(context).textTheme.headlineMedium,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: _incrementCounter,
|
|
||||||
tooltip: 'Increment',
|
|
||||||
child: const Icon(Icons.add),
|
|
||||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
import 'package:wien_talks/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
|
||||||
expect(find.text('0'), findsOneWidget);
|
|
||||||
expect(find.text('1'), findsNothing);
|
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
|
||||||
expect(find.text('0'), findsNothing);
|
|
||||||
expect(find.text('1'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
13
wien_talks/wien_talks_client/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Files and directories created by pub
|
||||||
|
.dart_tool/
|
||||||
|
.packages
|
||||||
|
|
||||||
|
# Omit committing pubspec.lock for library packages:
|
||||||
|
# https://dart.dev/guides/libraries/private-files#pubspeclock
|
||||||
|
pubspec.lock
|
||||||
|
|
||||||
|
# Conventional directory for build outputs
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Directory created by dartdoc
|
||||||
|
doc/api/
|
||||||
3
wien_talks/wien_talks_client/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
- Initial version, created by Stagehand
|
||||||
5
wien_talks/wien_talks_client/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# wien_talks_client
|
||||||
|
|
||||||
|
This is your Serverpod client. The code in here is mostly generated by
|
||||||
|
Serverpod, but you may want to make changes if you are adding modules to your
|
||||||
|
project.
|
||||||
13
wien_talks/wien_talks_client/analysis_options.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Defines a default set of lint rules enforced for
|
||||||
|
# projects at Google. For details and rationale,
|
||||||
|
# see https://github.com/dart-lang/pedantic#enabled-lints.
|
||||||
|
|
||||||
|
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
|
||||||
|
# Uncomment to specify additional rules.
|
||||||
|
# linter:
|
||||||
|
# rules:
|
||||||
|
# - camel_case_types
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- lib/src/protocol/**
|
||||||
5
wien_talks/wien_talks_client/dartdoc_options.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
dartdoc:
|
||||||
|
categories:
|
||||||
|
"Endpoint":
|
||||||
|
markdown: doc/endpoint.md
|
||||||
|
name: Endpoint
|
||||||
15
wien_talks/wien_talks_client/doc/endpoint.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Callable endpoints
|
||||||
|
|
||||||
|
Each class contains callable methods that will call a method on the server side. These are normally defined in the `endpoint` directory in your server project. This client sends requests to these endpoints and returns the result.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
// How to use GreetingEndpoint.
|
||||||
|
client.greeting.hello("world!");
|
||||||
|
|
||||||
|
// Generic format.
|
||||||
|
client.<endpoint>.<method>(...);
|
||||||
|
```
|
||||||
|
|
||||||
|
Please see the full official documentation [here](https://docs.serverpod.dev)
|
||||||
71
wien_talks/wien_talks_client/lib/src/protocol/client.dart
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||||
|
/* To generate run: "serverpod generate" */
|
||||||
|
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: library_private_types_in_public_api
|
||||||
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
// ignore_for_file: public_member_api_docs
|
||||||
|
// ignore_for_file: type_literal_in_constant_pattern
|
||||||
|
// ignore_for_file: use_super_parameters
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||||
|
import 'dart:async' as _i2;
|
||||||
|
import 'package:wien_talks_client/src/protocol/greeting.dart' as _i3;
|
||||||
|
import 'protocol.dart' as _i4;
|
||||||
|
|
||||||
|
/// This is an example endpoint that returns a greeting message through
|
||||||
|
/// its [hello] method.
|
||||||
|
/// {@category Endpoint}
|
||||||
|
class EndpointGreeting extends _i1.EndpointRef {
|
||||||
|
EndpointGreeting(_i1.EndpointCaller caller) : super(caller);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get name => 'greeting';
|
||||||
|
|
||||||
|
/// Returns a personalized greeting message: "Hello {name}".
|
||||||
|
_i2.Future<_i3.Greeting> hello(String name) =>
|
||||||
|
caller.callServerEndpoint<_i3.Greeting>(
|
||||||
|
'greeting',
|
||||||
|
'hello',
|
||||||
|
{'name': name},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Client extends _i1.ServerpodClientShared {
|
||||||
|
Client(
|
||||||
|
String host, {
|
||||||
|
dynamic securityContext,
|
||||||
|
_i1.AuthenticationKeyManager? authenticationKeyManager,
|
||||||
|
Duration? streamingConnectionTimeout,
|
||||||
|
Duration? connectionTimeout,
|
||||||
|
Function(
|
||||||
|
_i1.MethodCallContext,
|
||||||
|
Object,
|
||||||
|
StackTrace,
|
||||||
|
)? onFailedCall,
|
||||||
|
Function(_i1.MethodCallContext)? onSucceededCall,
|
||||||
|
bool? disconnectStreamsOnLostInternetConnection,
|
||||||
|
}) : super(
|
||||||
|
host,
|
||||||
|
_i4.Protocol(),
|
||||||
|
securityContext: securityContext,
|
||||||
|
authenticationKeyManager: authenticationKeyManager,
|
||||||
|
streamingConnectionTimeout: streamingConnectionTimeout,
|
||||||
|
connectionTimeout: connectionTimeout,
|
||||||
|
onFailedCall: onFailedCall,
|
||||||
|
onSucceededCall: onSucceededCall,
|
||||||
|
disconnectStreamsOnLostInternetConnection:
|
||||||
|
disconnectStreamsOnLostInternetConnection,
|
||||||
|
) {
|
||||||
|
greeting = EndpointGreeting(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final EndpointGreeting greeting;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, _i1.EndpointRef> get endpointRefLookup => {'greeting': greeting};
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, _i1.ModuleEndpointCaller> get moduleLookup => {};
|
||||||
|
}
|
||||||
95
wien_talks/wien_talks_client/lib/src/protocol/greeting.dart
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||||
|
/* To generate run: "serverpod generate" */
|
||||||
|
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: library_private_types_in_public_api
|
||||||
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
// ignore_for_file: public_member_api_docs
|
||||||
|
// ignore_for_file: type_literal_in_constant_pattern
|
||||||
|
// ignore_for_file: use_super_parameters
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||||
|
|
||||||
|
/// A greeting message which can be sent to or from the server.
|
||||||
|
abstract class Greeting implements _i1.SerializableModel {
|
||||||
|
Greeting._({
|
||||||
|
required this.message,
|
||||||
|
required this.author,
|
||||||
|
required this.timestamp,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Greeting({
|
||||||
|
required String message,
|
||||||
|
required String author,
|
||||||
|
required DateTime timestamp,
|
||||||
|
}) = _GreetingImpl;
|
||||||
|
|
||||||
|
factory Greeting.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||||
|
return Greeting(
|
||||||
|
message: jsonSerialization['message'] as String,
|
||||||
|
author: jsonSerialization['author'] as String,
|
||||||
|
timestamp:
|
||||||
|
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['timestamp']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The greeting message.
|
||||||
|
String message;
|
||||||
|
|
||||||
|
/// The author of the greeting message.
|
||||||
|
String author;
|
||||||
|
|
||||||
|
/// The time when the message was created.
|
||||||
|
DateTime timestamp;
|
||||||
|
|
||||||
|
/// Returns a shallow copy of this [Greeting]
|
||||||
|
/// with some or all fields replaced by the given arguments.
|
||||||
|
@_i1.useResult
|
||||||
|
Greeting copyWith({
|
||||||
|
String? message,
|
||||||
|
String? author,
|
||||||
|
DateTime? timestamp,
|
||||||
|
});
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'message': message,
|
||||||
|
'author': author,
|
||||||
|
'timestamp': timestamp.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return _i1.SerializationManager.encode(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GreetingImpl extends Greeting {
|
||||||
|
_GreetingImpl({
|
||||||
|
required String message,
|
||||||
|
required String author,
|
||||||
|
required DateTime timestamp,
|
||||||
|
}) : super._(
|
||||||
|
message: message,
|
||||||
|
author: author,
|
||||||
|
timestamp: timestamp,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Returns a shallow copy of this [Greeting]
|
||||||
|
/// with some or all fields replaced by the given arguments.
|
||||||
|
@_i1.useResult
|
||||||
|
@override
|
||||||
|
Greeting copyWith({
|
||||||
|
String? message,
|
||||||
|
String? author,
|
||||||
|
DateTime? timestamp,
|
||||||
|
}) {
|
||||||
|
return Greeting(
|
||||||
|
message: message ?? this.message,
|
||||||
|
author: author ?? this.author,
|
||||||
|
timestamp: timestamp ?? this.timestamp,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
wien_talks/wien_talks_client/lib/src/protocol/protocol.dart
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||||
|
/* To generate run: "serverpod generate" */
|
||||||
|
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: library_private_types_in_public_api
|
||||||
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
// ignore_for_file: public_member_api_docs
|
||||||
|
// ignore_for_file: type_literal_in_constant_pattern
|
||||||
|
// ignore_for_file: use_super_parameters
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'package:serverpod_client/serverpod_client.dart' as _i1;
|
||||||
|
import 'greeting.dart' as _i2;
|
||||||
|
export 'greeting.dart';
|
||||||
|
export 'client.dart';
|
||||||
|
|
||||||
|
class Protocol extends _i1.SerializationManager {
|
||||||
|
Protocol._();
|
||||||
|
|
||||||
|
factory Protocol() => _instance;
|
||||||
|
|
||||||
|
static final Protocol _instance = Protocol._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
T deserialize<T>(
|
||||||
|
dynamic data, [
|
||||||
|
Type? t,
|
||||||
|
]) {
|
||||||
|
t ??= T;
|
||||||
|
if (t == _i2.Greeting) {
|
||||||
|
return _i2.Greeting.fromJson(data) as T;
|
||||||
|
}
|
||||||
|
if (t == _i1.getType<_i2.Greeting?>()) {
|
||||||
|
return (data != null ? _i2.Greeting.fromJson(data) : null) as T;
|
||||||
|
}
|
||||||
|
return super.deserialize<T>(data, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? getClassNameForObject(Object? data) {
|
||||||
|
String? className = super.getClassNameForObject(data);
|
||||||
|
if (className != null) return className;
|
||||||
|
if (data is _i2.Greeting) {
|
||||||
|
return 'Greeting';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
dynamic deserializeByClassName(Map<String, dynamic> data) {
|
||||||
|
var dataClassName = data['className'];
|
||||||
|
if (dataClassName is! String) {
|
||||||
|
return super.deserializeByClassName(data);
|
||||||
|
}
|
||||||
|
if (dataClassName == 'Greeting') {
|
||||||
|
return deserialize<_i2.Greeting>(data['data']);
|
||||||
|
}
|
||||||
|
return super.deserializeByClassName(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
2
wien_talks/wien_talks_client/lib/wien_talks_client.dart
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
export 'src/protocol/protocol.dart';
|
||||||
|
export 'package:serverpod_client/serverpod_client.dart';
|
||||||
8
wien_talks/wien_talks_client/pubspec.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
name: wien_talks_client
|
||||||
|
description: Starting point for a Serverpod client.
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: '>=3.5.0 <4.0.0'
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
serverpod_client: 2.9.1
|
||||||
|
|
@ -5,12 +5,9 @@
|
||||||
*.swp
|
*.swp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.atom/
|
.atom/
|
||||||
.build/
|
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
.swiftpm/
|
|
||||||
migrate_working_dir/
|
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
|
|
@ -29,11 +26,15 @@ migrate_working_dir/
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
.packages
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Symbolication related
|
# Web related
|
||||||
|
lib/generated_plugin_registrant.dart
|
||||||
|
|
||||||
|
# Symbolization related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
# Obfuscation related
|
# Obfuscation related
|
||||||
|
|
@ -43,3 +44,4 @@ app.*.map.json
|
||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
|
||||||
15
wien_talks/wien_talks_flutter/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# wien_talks_flutter
|
||||||
|
|
||||||
|
A new Flutter project with Serverpod.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
This project is a starting point for a Flutter application that is using
|
||||||
|
Serverpod.
|
||||||
|
|
||||||
|
A great starting point for learning Serverpod is our documentation site at:
|
||||||
|
[https://docs.serverpod.dev](https://docs.serverpod.dev).
|
||||||
|
|
||||||
|
To run the project, first make sure that the server is running, then do:
|
||||||
|
|
||||||
|
flutter run
|
||||||
|
|
@ -13,7 +13,8 @@ linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
# The lint rules applied to this project can be customized in the
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
# included above or to enable additional rules. A list of all available lints
|
# included above or to enable additional rules. A list of all available lints
|
||||||
# and their documentation is published at https://dart.dev/lints.
|
# and their documentation is published at
|
||||||
|
# https://dart-lang.github.io/linter/lints/index.html.
|
||||||
#
|
#
|
||||||
# Instead of disabling a lint rule for the entire project in the
|
# Instead of disabling a lint rule for the entire project in the
|
||||||
# section below, it can also be suppressed for a single line of code
|
# section below, it can also be suppressed for a single line of code
|
||||||
|
|
@ -23,6 +24,5 @@ linter:
|
||||||
rules:
|
rules:
|
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||||
|
|
||||||
# Additional information about this file can be found at
|
# Additional information about this file can be found at
|
||||||
# https://dart.dev/guides/language/analysis-options
|
# https://dart.dev/guides/language/analysis-options
|
||||||
|
|
@ -6,7 +6,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.example.wien_talks"
|
namespace = "com.example.wien_talks_flutter"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = flutter.ndkVersion
|
ndkVersion = flutter.ndkVersion
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId = "com.example.wien_talks"
|
applicationId = "com.example.wien_talks_flutter"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||||
minSdk = flutter.minSdkVersion
|
minSdk = flutter.minSdkVersion
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application
|
<application
|
||||||
android:label="wien_talks"
|
android:label="wien_talks_flutter"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.wien_talks
|
package com.example.wien_talks_flutter
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
|
@ -368,7 +368,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|
@ -384,7 +384,7 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
|
@ -401,7 +401,7 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||||
|
|
@ -416,7 +416,7 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||||
|
|
@ -547,7 +547,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
|
@ -569,7 +569,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 862 B |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 862 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
|
|
@ -5,7 +5,7 @@
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Wien Talks</string>
|
<string>Wien Talks Flutter</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>wien_talks</string>
|
<string>wien_talks_flutter</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
145
wien_talks/wien_talks_flutter/lib/main.dart
Normal file
|
|
@ -0,0 +1,145 @@
|
||||||
|
import 'package:wien_talks_client/wien_talks_client.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:serverpod_flutter/serverpod_flutter.dart';
|
||||||
|
|
||||||
|
/// Sets up a global client object that can be used to talk to the server from
|
||||||
|
/// anywhere in our app. The client is generated from your server code
|
||||||
|
/// and is set up to connect to a Serverpod running on a local server on
|
||||||
|
/// the default port. You will need to modify this to connect to staging or
|
||||||
|
/// production servers.
|
||||||
|
/// In a larger app, you may want to use the dependency injection of your choice
|
||||||
|
/// instead of using a global client object. This is just a simple example.
|
||||||
|
late final Client client;
|
||||||
|
|
||||||
|
late String serverUrl;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// When you are running the app on a physical device, you need to set the
|
||||||
|
// server URL to the IP address of your computer. You can find the IP
|
||||||
|
// address by running `ipconfig` on Windows or `ifconfig` on Mac/Linux.
|
||||||
|
// You can set the variable when running or building your app like this:
|
||||||
|
// E.g. `flutter run --dart-define=SERVER_URL=https://api.example.com/`
|
||||||
|
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
|
||||||
|
final serverUrl =
|
||||||
|
serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
|
||||||
|
|
||||||
|
client = Client(serverUrl)
|
||||||
|
..connectivityMonitor = FlutterConnectivityMonitor();
|
||||||
|
|
||||||
|
runApp(const MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: 'Serverpod Demo',
|
||||||
|
theme: ThemeData(primarySwatch: Colors.blue),
|
||||||
|
home: const MyHomePage(title: 'Serverpod Example'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyHomePage extends StatefulWidget {
|
||||||
|
const MyHomePage({super.key, required this.title});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
@override
|
||||||
|
MyHomePageState createState() => MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyHomePageState extends State<MyHomePage> {
|
||||||
|
/// Holds the last result or null if no result exists yet.
|
||||||
|
String? _resultMessage;
|
||||||
|
|
||||||
|
/// Holds the last error message that we've received from the server or null
|
||||||
|
/// if no error exists yet.
|
||||||
|
String? _errorMessage;
|
||||||
|
|
||||||
|
final _textEditingController = TextEditingController();
|
||||||
|
|
||||||
|
/// Calls the `hello` method of the `greeting` endpoint. Will set either the
|
||||||
|
/// `_resultMessage` or `_errorMessage` field, depending on if the call
|
||||||
|
/// is successful.
|
||||||
|
void _callHello() async {
|
||||||
|
try {
|
||||||
|
final result = await client.greeting.hello(_textEditingController.text);
|
||||||
|
setState(() {
|
||||||
|
_errorMessage = null;
|
||||||
|
_resultMessage = result.message;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_errorMessage = '$e';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text(widget.title)),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: TextField(
|
||||||
|
controller: _textEditingController,
|
||||||
|
decoration: const InputDecoration(hintText: 'Enter your name'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _callHello,
|
||||||
|
child: const Text('Send to Server'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ResultDisplay(
|
||||||
|
resultMessage: _resultMessage,
|
||||||
|
errorMessage: _errorMessage,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ResultDisplays shows the result of the call. Either the returned result
|
||||||
|
/// from the `example.greeting` endpoint method or an error message.
|
||||||
|
class ResultDisplay extends StatelessWidget {
|
||||||
|
final String? resultMessage;
|
||||||
|
final String? errorMessage;
|
||||||
|
|
||||||
|
const ResultDisplay({super.key, this.resultMessage, this.errorMessage});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
String text;
|
||||||
|
Color backgroundColor;
|
||||||
|
if (errorMessage != null) {
|
||||||
|
backgroundColor = Colors.red[300]!;
|
||||||
|
text = errorMessage!;
|
||||||
|
} else if (resultMessage != null) {
|
||||||
|
backgroundColor = Colors.green[300]!;
|
||||||
|
text = resultMessage!;
|
||||||
|
} else {
|
||||||
|
backgroundColor = Colors.grey[300]!;
|
||||||
|
text = 'No server response yet.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(minHeight: 50),
|
||||||
|
child: Container(
|
||||||
|
color: backgroundColor,
|
||||||
|
child: Center(child: Text(text)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,10 +4,10 @@ project(runner LANGUAGES CXX)
|
||||||
|
|
||||||
# The name of the executable created for the application. Change this to change
|
# The name of the executable created for the application. Change this to change
|
||||||
# the on-disk name of your application.
|
# the on-disk name of your application.
|
||||||
set(BINARY_NAME "wien_talks")
|
set(BINARY_NAME "wien_talks_flutter")
|
||||||
# The unique GTK application identifier for this application. See:
|
# The unique GTK application identifier for this application. See:
|
||||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||||
set(APPLICATION_ID "com.example.wien_talks")
|
set(APPLICATION_ID "com.example.wien_talks_flutter")
|
||||||
|
|
||||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||||
# versions of CMake.
|
# versions of CMake.
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
|
||||||
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
#define GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
|
||||||
|
#include <flutter_linux/flutter_linux.h>
|
||||||
|
|
||||||
|
// Registers Flutter plugins.
|
||||||
|
void fl_register_plugins(FlPluginRegistry* registry);
|
||||||
|
|
||||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#
|
||||||
|
# Generated file, do not edit.
|
||||||
|
#
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
)
|
||||||
|
|
||||||
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
||||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
||||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||||
|
endforeach(plugin)
|
||||||
|
|
||||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||||
|
endforeach(ffi_plugin)
|
||||||
|
|
@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
|
||||||
if (use_header_bar) {
|
if (use_header_bar) {
|
||||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||||
gtk_header_bar_set_title(header_bar, "wien_talks");
|
gtk_header_bar_set_title(header_bar, "wien_talks_flutter");
|
||||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||||
} else {
|
} else {
|
||||||
gtk_window_set_title(window, "wien_talks");
|
gtk_window_set_title(window, "wien_talks_flutter");
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_default_size(window, 1280, 720);
|
gtk_window_set_default_size(window, 1280, 720);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
import FlutterMacOS
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
import connectivity_plus
|
||||||
|
|
||||||
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
|
||||||
|
}
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||||
33CC10ED2044A3C60003C045 /* wien_talks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "wien_talks.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
33CC10ED2044A3C60003C045 /* wien_talks_flutter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "wien_talks_flutter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
33CC10EE2044A3C60003C045 /* Products */ = {
|
33CC10EE2044A3C60003C045 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
33CC10ED2044A3C60003C045 /* wien_talks.app */,
|
33CC10ED2044A3C60003C045 /* wien_talks_flutter.app */,
|
||||||
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
|
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
productReference = 33CC10ED2044A3C60003C045 /* wien_talks.app */;
|
productReference = 33CC10ED2044A3C60003C045 /* wien_talks_flutter.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
|
|
@ -385,10 +385,10 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks_flutter";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
@ -399,10 +399,10 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks_flutter";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
@ -413,10 +413,10 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalks.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.wienTalksFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wien_talks_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/wien_talks_flutter";
|
||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
};
|
};
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "wien_talks.app"
|
BuildableName = "wien_talks_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "wien_talks.app"
|
BuildableName = "wien_talks_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "wien_talks.app"
|
BuildableName = "wien_talks_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "wien_talks.app"
|
BuildableName = "wien_talks_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||