Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Pattle
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
71
Issues
71
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pattle
Pattle
Commits
ae66bd4c
Verified
Commit
ae66bd4c
authored
Jun 17, 2019
by
Wilko Manger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use platform aware widgets on StartPage
parent
24eff5c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
40 deletions
+85
-40
lib/src/app.dart
lib/src/app.dart
+14
-15
lib/src/ui/start/start_page.dart
lib/src/ui/start/start_page.dart
+62
-25
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+2
-0
No files found.
lib/src/app.dart
View file @
ae66bd4c
...
...
@@ -17,6 +17,7 @@
import
'package:flutter/material.dart'
;
import
'package:flutter_localizations/flutter_localizations.dart'
;
import
'package:flutter_platform_widgets/flutter_platform_widgets.dart'
;
import
'package:matrix_sdk/matrix_sdk.dart'
;
import
'package:pattle/src/ui/initial/initial_page.dart'
;
import
'package:pattle/src/ui/main/chat/chat_page.dart'
;
...
...
@@ -28,19 +29,15 @@ import 'package:pattle/src/ui/start/advanced_page.dart';
import
'package:pattle/src/ui/start/phase/identity/username_page.dart'
;
import
'package:pattle/src/ui/start/phase/key/password_page.dart'
;
import
'package:pattle/src/ui/start/start_page.dart'
;
import
'package:pattle/src/ui/main/overview/create/group/create_group_members_page.dart'
;
import
'ui/main/overview/create/group/create_group_details_page.dart'
;
final
routes
=
{
Routes
.
root
:
(
Object
params
)
=>
Material
PageRoute
(
Routes
.
root
:
(
Object
params
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
root
),
builder:
(
context
)
=>
InitialPage
()
),
Routes
.
chats
:
(
Object
arguments
)
=>
Material
PageRoute
(
Routes
.
chats
:
(
Object
arguments
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
chats
),
builder:
(
context
)
{
if
(
arguments
is
Room
)
{
...
...
@@ -50,31 +47,31 @@ final routes = {
}
}
),
Routes
.
chatsNew
:
(
Object
arguments
)
=>
Material
PageRoute
(
Routes
.
chatsNew
:
(
Object
arguments
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
chatsNew
),
builder:
(
context
)
=>
CreateGroupMembersPage
()
),
Routes
.
chatsNewDetails
:
(
Object
arguments
)
=>
Material
PageRoute
(
Routes
.
chatsNewDetails
:
(
Object
arguments
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
chatsNewDetails
),
builder:
(
context
)
=>
CreateGroupDetailsPage
()
),
Routes
.
image
:
(
Object
arguments
)
=>
Material
PageRoute
(
Routes
.
image
:
(
Object
arguments
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
image
),
builder:
(
context
)
=>
ImagePage
(
arguments
)
),
Routes
.
start
:
(
Object
params
)
=>
Material
PageRoute
(
Routes
.
start
:
(
Object
params
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
start
),
builder:
(
context
)
=>
StartPage
()
),
Routes
.
startAdvanced
:
(
Object
params
)
=>
Material
PageRoute
(
Routes
.
startAdvanced
:
(
Object
params
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
startAdvanced
),
builder:
(
context
)
=>
AdvancedPage
()
),
Routes
.
startUsername
:
(
Object
params
)
=>
Material
PageRoute
(
Routes
.
startUsername
:
(
Object
params
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
startUsername
),
builder:
(
context
)
=>
UsernamePage
()
),
Routes
.
startPassword
:
(
Object
params
)
=>
Material
PageRoute
(
Routes
.
startPassword
:
(
Object
params
)
=>
platform
PageRoute
(
settings:
RouteSettings
(
name:
Routes
.
startPassword
),
builder:
(
context
)
=>
PasswordPage
()
),
...
...
@@ -102,10 +99,9 @@ class App extends StatelessWidget {
// This widget is the root of your application.
@override
Widget
build
(
BuildContext
context
)
{
return
Material
App
(
return
Platform
App
(
onGenerateTitle:
(
BuildContext
context
)
=>
l
(
context
).
appName
,
theme:
lightTheme
,
localizationsDelegates:
[
const
AppLocalizationsDelegate
(),
GlobalMaterialLocalizations
.
delegate
,
...
...
@@ -118,6 +114,9 @@ class App extends StatelessWidget {
onGenerateRoute:
(
settings
)
{
return
routes
[
settings
.
name
](
settings
.
arguments
);
},
android:
(
_
)
=>
MaterialAppData
(
theme:
lightTheme
,
),
);
}
}
\ No newline at end of file
lib/src/ui/start/start_page.dart
View file @
ae66bd4c
...
...
@@ -14,21 +14,30 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_platform_widgets/flutter_platform_widgets.dart'
;
import
'package:pattle/src/app.dart'
;
import
'package:pattle/src/ui/resources/localizations.dart'
;
class
StartPage
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
final
buttonShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
96
)
);
// TODO: PR: Make BorderRadius.circular const
static
const
buttonBorderRadius
=
BorderRadius
.
all
(
Radius
.
circular
(
96
));
final
buttonPadding
=
EdgeInsets
.
all
(
16
);
static
const
buttonShape
=
RoundedRectangleBorder
(
borderRadius:
buttonBorderRadius
);
return
Scaffold
(
static
const
buttonPadding
=
EdgeInsets
.
all
(
16
);
void
_loginWithUsername
(
BuildContext
context
)
{
Navigator
.
pushNamed
(
context
,
Routes
.
startUsername
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
PlatformScaffold
(
body:
Container
(
margin:
const
EdgeInsets
.
only
(
top:
16
),
child:
Center
(
...
...
@@ -41,28 +50,56 @@ class StartPage extends StatelessWidget {
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
<
Widget
>[
RaisedButton
(
onPressed:
null
,
child:
Text
(
l
(
context
).
loginWithPhone
.
toUpperCase
()),
shape:
buttonShape
,
padding:
buttonPadding
,
PlatformWidget
(
android:
(
_
)
=>
RaisedButton
(
onPressed:
null
,
child:
PlatformText
(
l
(
context
).
loginWithPhone
),
shape:
buttonShape
,
padding:
buttonPadding
,
),
ios:
(
_
)
=>
CupertinoButton
.
filled
(
onPressed:
null
,
child:
Text
(
l
(
context
).
loginWithPhone
),
borderRadius:
buttonBorderRadius
,
padding:
buttonPadding
,
)
),
SizedBox
(
height:
16
),
OutlineButton
(
onPressed:
null
,
child:
Text
(
l
(
context
).
loginWithEmail
.
toUpperCase
()),
shape:
buttonShape
,
padding:
buttonPadding
,
PlatformWidget
(
android:
(
_
)
=>
OutlineButton
(
onPressed:
null
,
child:
PlatformText
(
l
(
context
).
loginWithEmail
),
shape:
buttonShape
,
padding:
buttonPadding
,
),
ios:
(
_
)
=>
CupertinoButton
(
onPressed:
null
,
child:
Text
(
l
(
context
).
loginWithEmail
),
borderRadius:
buttonBorderRadius
,
padding:
buttonPadding
,
)
),
SizedBox
(
height:
16
),
FlatButton
(
onPressed:
()
{
Navigator
.
pushNamed
(
context
,
Routes
.
startUsername
);
},
child:
Text
(
l
(
context
).
loginWithUsername
.
toUpperCase
()),
shape:
buttonShape
,
padding:
buttonPadding
,
),
PlatformWidget
(
android:
(
_
)
=>
FlatButton
(
onPressed:
()
=>
_loginWithUsername
(
context
),
child:
PlatformText
(
l
(
context
).
loginWithUsername
),
shape:
buttonShape
,
padding:
buttonPadding
,
),
ios:
(
_
)
=>
CupertinoButton
(
onPressed:
()
=>
_loginWithUsername
(
context
),
child:
Text
(
l
(
context
).
loginWithUsername
),
borderRadius:
buttonBorderRadius
,
padding:
buttonPadding
,
)
)
],
)
],
...
...
pubspec.lock
View file @
ae66bd4c
...
...
@@ -132,6 +132,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_platform_widgets:
dependency: "direct main"
description:
name: flutter_platform_widgets
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.0"
flutter_test:
dependency: "direct dev"
description: flutter
...
...
pubspec.yaml
View file @
ae66bd4c
...
...
@@ -32,6 +32,8 @@ dependencies:
flutter_dotenv
:
^2.0.1
flutter_platform_widgets
:
^0.10.0
respect_24_hour
:
^0.0.2
transparent_image
:
^1.0.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment