Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile
gmalpha_flutter
Commits
1141c9a2
Commit
1141c9a2
authored
Dec 16, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qqq
parent
18acfa0a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
428 deletions
+0
-428
animationTest.dart
lib/commonModel/testPage/animationTest.dart
+0
-0
applicationTest.dart
lib/commonModel/testPage/applicationTest.dart
+0
-65
assetsChannel.dart
lib/commonModel/testPage/assetsChannel.dart
+0
-99
battery.dart
lib/commonModel/testPage/battery.dart
+0
-83
layoutTest.dart
lib/commonModel/testPage/layoutTest.dart
+0
-113
netWorkTest.dart
lib/commonModel/testPage/netWorkTest.dart
+0
-68
No files found.
lib/commonModel/testPage/animationTest.dart
deleted
100644 → 0
View file @
18acfa0a
This diff is collapsed.
Click to expand it.
lib/commonModel/testPage/applicationTest.dart
deleted
100644 → 0
View file @
18acfa0a
import
'package:flutter/material.dart'
;
import
'animationTest.dart'
;
import
'layoutTest.dart'
;
class
MyApplicaitonTest
extends
StatefulWidget
{
@override
_MyApplicaitonTestState
createState
()
=>
_MyApplicaitonTestState
();
}
class
_MyApplicaitonTestState
extends
State
<
MyApplicaitonTest
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'Flutter Demo'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
),
home:
WidgetA
(),
routes:
{
"/layouttest"
:
layoutTestPage
,
},
);
}
Widget
layoutTestPage
(
BuildContext
context
)
{
return
LayoutTest
();
}
}
class
WidgetA
extends
StatefulWidget
{
final
Widget
child
;
WidgetA
({
Key
key
,
this
.
child
})
:
super
(
key:
key
);
_WidgetAState
createState
()
=>
_WidgetAState
();
}
class
_WidgetAState
extends
State
<
WidgetA
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'text'
),
),
body:
Container
(
padding:
EdgeInsets
.
all
(
32.0
),
child:
Center
(
child:
Column
(
children:
<
Widget
>[
Center
(
child:
FlatButton
(
child:
Text
(
'hit me'
),
onPressed:
(){
Navigator
.
of
(
context
).
pushNamed
(
"/layouttest"
);
},
),
)
],
),
),
),
);
}
}
\ No newline at end of file
lib/commonModel/testPage/assetsChannel.dart
deleted
100644 → 0
View file @
18acfa0a
import
'dart:async'
;
import
'dart:typed_data'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
class
AssestPlatformChannel
extends
StatefulWidget
{
@override
_AssestPlatformChannelState
createState
()
=>
_AssestPlatformChannelState
();
}
class
_AssestPlatformChannelState
extends
State
<
AssestPlatformChannel
>
{
static
const
MethodChannel
methodChannel
=
MethodChannel
(
'GMAssetsMethodChannelName'
);
static
const
EventChannel
eventChannel
=
EventChannel
(
'GMAssetsEventChannelName'
);
Uint8List
_imageData
;
String
_tttt
=
'ssss'
;
Future
<
void
>
_editPortrait
()
async
{
Uint8List
imageData
;
try
{
final
result
=
await
methodChannel
.
invokeMethod
(
'editPortrait'
);
imageData
=
result
;
}
on
PlatformException
{
imageData
=
null
;
}
setState
(()
{
_imageData
=
imageData
;
_tttt
=
_imageData
.
runtimeType
.
toString
();
});
}
@override
void
initState
()
{
super
.
initState
();
eventChannel
.
receiveBroadcastStream
().
listen
(
_onEvent
,
onError:
_onError
);
}
void
_onEvent
(
Object
event
)
{
setState
(()
{});
}
void
_onError
(
Object
error
)
{
setState
(()
{});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Material
(
child:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'editPortrait test'
),
),
body:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
<
Widget
>[
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
Text
(
_tttt
,
key:
const
Key
(
'editPortrait'
)),
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
RaisedButton
(
child:
const
Text
(
'editPortrait'
),
onPressed:
_editPortrait
,
),
),
Container
(
color:
Colors
.
pink
[
300
],
width:
300
,
height:
300
,
child:
_imageWidget
()
)
],
),
],
),
),
),
);
}
Widget
_imageWidget
(){
if
(
_imageData
!=
null
)
{
return
Image
.
memory
(
_imageData
,
width:
200
,
height:
200
,
);
}
else
{
return
Center
(
child:
Text
(
'I am not image'
+
_tttt
),
);
}
}
}
lib/commonModel/testPage/battery.dart
deleted
100644 → 0
View file @
18acfa0a
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
class
PlatformChannel
extends
StatefulWidget
{
@override
_PlatformChannelState
createState
()
=>
_PlatformChannelState
();
}
class
_PlatformChannelState
extends
State
<
PlatformChannel
>
{
static
const
MethodChannel
methodChannel
=
MethodChannel
(
'samples.flutter.io/battery'
);
static
const
EventChannel
eventChannel
=
EventChannel
(
'samples.flutter.io/charging'
);
String
_batteryLevel
=
'Battery level: unknown.'
;
String
_chargingStatus
=
'Battery status: unknown.'
;
Future
<
void
>
_getBatteryLevel
()
async
{
String
batteryLevel
;
try
{
final
int
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
batteryLevel
=
'Battery level:
$result
%.'
;
}
on
PlatformException
{
batteryLevel
=
'Failed to get battery level.'
;
}
setState
(()
{
_batteryLevel
=
batteryLevel
;
});
}
@override
void
initState
()
{
super
.
initState
();
eventChannel
.
receiveBroadcastStream
().
listen
(
_onEvent
,
onError:
_onError
);
}
void
_onEvent
(
Object
event
)
{
setState
(()
{
_chargingStatus
=
"Battery status:
${event == 'charging' ? '' : 'dis'}
charging."
;
});
}
void
_onError
(
Object
error
)
{
setState
(()
{
_chargingStatus
=
'Battery status: unknown.'
;
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Material
(
child:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Channel test'
),
),
body:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
<
Widget
>[
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
Text
(
_batteryLevel
,
key:
const
Key
(
'Battery level label'
)),
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
RaisedButton
(
child:
const
Text
(
'Refresh'
),
onPressed:
_getBatteryLevel
,
),
),
],
),
Text
(
_chargingStatus
),
],
),
),
),
);
}
}
lib/commonModel/testPage/layoutTest.dart
deleted
100644 → 0
View file @
18acfa0a
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
class
LayoutTest
extends
StatefulWidget
{
@override
_LayoutTestState
createState
()
=>
_LayoutTestState
();
}
class
_LayoutTestState
extends
State
<
LayoutTest
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Layout Test'
),
),
body:
Container
(
padding:
EdgeInsets
.
all
(
32.0
),
child:
Center
(
child:
Column
(
children:
<
Widget
>[
_renderBoxTest
(),
_containerTestWidget
()
],
),
),
),
);
}
Widget
_renderBoxTest
(
){
return
Container
(
color:
Colors
.
greenAccent
,
width:
double
.
infinity
,
constraints:
BoxConstraints
(
maxWidth:
double
.
infinity
,
minWidth:
200.0
,
maxHeight:
200
,
minHeight:
100.0
),
child:
Stingy
(
child:
Container
(
color:
Colors
.
pink
[
200
],
),
),
);
}
// www.baidu.com/img/bd_logo1.png
Widget
_containerTestWidget
(){
return
Container
(
constraints:
BoxConstraints
.
expand
(
height:
Theme
.
of
(
context
).
textTheme
.
display1
.
fontSize
*
1.1
+
200.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
color:
Colors
.
greenAccent
.
shade700
,
alignment:
Alignment
.
bottomCenter
,
child:
Text
(
'Hello World'
,
style:
Theme
.
of
(
context
).
textTheme
.
display1
.
copyWith
(
color:
Colors
.
orange
[
200
])),
foregroundDecoration:
BoxDecoration
(
image:
DecorationImage
(
image:
NetworkImage
(
'https://www.example.com/images/frame.png'
),
centerSlice:
Rect
.
fromLTRB
(
270.0
,
180.0
,
1360.0
,
730.0
),
),
),
transform:
Matrix4
.
rotationZ
(
0.1
),
);
}
}
class
Stingy
extends
SingleChildRenderObjectWidget
{
Stingy
({
Widget
child
})
:
super
(
child:
child
);
@override
RenderObject
createRenderObject
(
BuildContext
context
)
{
// TODO: implement createRenderObject
return
RenderStingy
();
}
}
class
RenderStingy
extends
RenderShiftedBox
{
RenderStingy
()
:
super
(
null
);
// 绘制方法
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
// TODO: implement paint
super
.
paint
(
context
,
offset
);
}
// 布局方法
@override
void
performLayout
()
{
// 布局 child 确定 child 的 size
child
.
layout
(
BoxConstraints
(
minHeight:
0.0
,
maxHeight:
constraints
.
minHeight
,
minWidth:
0.0
,
maxWidth:
constraints
.
minWidth
),
parentUsesSize:
true
);
print
(
'constraints:
$constraints
'
);
// child 的 Offset
final
BoxParentData
childParentData
=
child
.
parentData
;
childParentData
.
offset
=
Offset
(
constraints
.
maxWidth
-
child
.
size
.
width
,
constraints
.
maxHeight
-
child
.
size
.
height
);
print
(
'childParentData:
$childParentData
'
);
// 确定自己(父节点)的大小,并重绘父节点。不重设,不能触发重绘,例如在热重载的情景中,重设container.maxHeight,无效
size
=
Size
(
constraints
.
maxWidth
,
constraints
.
maxHeight
);
print
(
'size:
$size
'
);
}
}
lib/commonModel/testPage/netWorkTest.dart
deleted
100644 → 0
View file @
18acfa0a
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/commonModel/net/ALNetWork.dart'
;
void
main
(
)
=>
runApp
(
MaterialApp
(
home:
NetWorkTestPage
(),
));
class
NetWorkTestPage
extends
StatefulWidget
{
@override
_NetWorkTestPageState
createState
()
=>
_NetWorkTestPageState
();
}
class
_NetWorkTestPageState
extends
State
<
NetWorkTestPage
>
{
String
_string
=
'lalala'
;
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'NewtWork Test Page'
),
),
body:
Container
(
padding:
EdgeInsets
.
all
(
32.0
),
child:
Center
(
child:
Column
(
children:
<
Widget
>[
FlatButton
(
child:
Text
(
'newtWorkTest'
),
color:
Colors
.
greenAccent
,
onPressed:
_netWork
,
),
Container
(
color:
Colors
.
greenAccent
,
constraints:
BoxConstraints
(
maxWidth:
double
.
infinity
,
minWidth:
200.0
,
maxHeight:
500
,
minHeight:
200.0
),
child:
Text
(
'data:'
+
_string
),
),
],
),
),
),
);
}
void
_netWork
()
{
ALNetwork
(
success:
(
NetworkSuccess
success
){
print
(
success
.
data
);
setState
(()
{
_string
=
success
.
data
.
toString
();
});
},
error:
(
NetworkError
error
){
print
(
error
.
error
);
setState
(()
{
_string
=
error
.
error
.
toString
();
});
},
api:
'/api/v1/index'
)
..
excuteGet
();
}
}
\ No newline at end of file
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