26 changed files with 707 additions and 130 deletions
Unified View
Diff Options
-
BINassets/H.png
-
BINassets/chat.png
-
BINassets/chat_active.png
-
BINassets/friend.png
-
BINassets/friend_active.png
-
BINassets/home_top_active.png
-
BINassets/i.png
-
BINassets/index.png
-
BINassets/index_active.png
-
BINassets/location_icon.png
-
BINassets/my.png
-
BINassets/my_active.png
-
BINassets/pic1.png
-
BINassets/pic2.png
-
BINassets/pic3.png
-
BINassets/real_name.png
-
BINassets/subscript.png
-
BINassets/user_avatar.png
-
74lib/components/home_appbar.dart
-
2lib/components/page_appbar.dart
-
5lib/main.dart
-
62lib/pages/home_page.dart
-
394lib/pages/index_page.dart
-
268lib/pages/live_page.dart
-
2pubspec.yaml
-
30test/widget_test.dart
@ -0,0 +1,74 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
|
||||
|
class HomeAppbar extends StatefulWidget { |
||||
|
|
||||
|
final List<String> topNav; |
||||
|
final void Function(int) changeNav; |
||||
|
const HomeAppbar({super.key, required this.topNav, required this.changeNav}); |
||||
|
|
||||
|
@override |
||||
|
State<HomeAppbar> createState() => _HomeAppbarState(); |
||||
|
} |
||||
|
|
||||
|
class _HomeAppbarState extends State<HomeAppbar> { |
||||
|
|
||||
|
int active = 0; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Container( |
||||
|
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), |
||||
|
child: Container( |
||||
|
height: ScreenUtil().setWidth(108), |
||||
|
padding: EdgeInsets.symmetric( |
||||
|
horizontal: ScreenUtil().setWidth(34)), |
||||
|
child: Stack( |
||||
|
children: [ |
||||
|
Row( |
||||
|
crossAxisAlignment: CrossAxisAlignment.center, |
||||
|
mainAxisAlignment: MainAxisAlignment.center, |
||||
|
children: [ |
||||
|
...widget.topNav.asMap().entries.map((entry){ |
||||
|
return InkWell( |
||||
|
onTap: (){ |
||||
|
active = entry.key; |
||||
|
widget.changeNav(active); |
||||
|
setState(() { |
||||
|
|
||||
|
}); |
||||
|
}, |
||||
|
child: Container( |
||||
|
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(27)), |
||||
|
child: Column( |
||||
|
crossAxisAlignment: CrossAxisAlignment.center, |
||||
|
mainAxisAlignment: MainAxisAlignment.center, |
||||
|
children: [ |
||||
|
Text( |
||||
|
entry.value, |
||||
|
style: TextStyle( |
||||
|
fontSize: active == entry.key ? 38.w : 34.w, |
||||
|
color: const Color.fromRGBO(51, 51, 51, 1), |
||||
|
fontWeight: active == entry.key ? FontWeight.w600 : FontWeight.w400 |
||||
|
), |
||||
|
), |
||||
|
SizedBox(height: ScreenUtil().setWidth(9),), |
||||
|
if(active == entry.key) Image.asset( |
||||
|
"assets/home_top_active.png", |
||||
|
width: ScreenUtil().setWidth(25), |
||||
|
) |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
}), |
||||
|
|
||||
|
|
||||
|
], |
||||
|
) |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -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:dating_touchme_app/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
Loading…
Cancel
Save