Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
flutter-demo
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘博华
flutter-demo
Commits
7bd0f51c
Commit
7bd0f51c
authored
Apr 08, 2022
by
杜長金
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
4c5cd564
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
33 deletions
+32
-33
lib/main.dart
+32
-3
test/widget_test.dart
+0
-30
No files found.
lib/main.dart
View file @
7bd0f51c
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
main
()
{
main
()
{
runApp
(
const
MyApp
());
runApp
(
MyApp
());
}
}
class
MyApp
extends
StatelessWidget
{
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
home:
Container
(
child:
Text
(
"aaa"
),
),
);
}
}
class
HomePage
extends
StatelessWidget
{
List
tabs
=
[
"全部"
,
"待付款"
,
"點評/投票"
];
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Container
();
return
new
DefaultTabController
(
length:
tabs
.
length
,
child:
new
Scaffold
(
appBar:
AppBar
(
bottom:
TabBar
(
//生成Tab菜单
tabs:
tabs
.
map
((
e
)
=>
Tab
(
text:
e
)).
toList
()),
),
body:
new
TabBarView
(
children:
tabs
.
map
((
e
)
{
//分别创建对应的Tab页面
return
Container
(
alignment:
Alignment
.
center
,
child:
Text
(
e
,
textScaleFactor:
5
),
);
}).
toList
(),
),
),
);
}
}
}
}
test/widget_test.dart
deleted
100644 → 0
View file @
4c5cd564
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. 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:flutter_one/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
);
});
}
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