Skip to content

Commit

Permalink
✨ (feat) 修改id,完成tab布局
Browse files Browse the repository at this point in the history
  • Loading branch information
coolrc136 committed Nov 29, 2021
1 parent bbbbfb9 commit 817ea28
Show file tree
Hide file tree
Showing 28 changed files with 439 additions and 217 deletions.
15 changes: 12 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter Debug",
"type": "dart",
"name": "jandan",
"request": "launch",
"program": "lib/main.dart"
"type": "dart"
},
{
"name": "jandan (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
}
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "flutter-template2"
applicationId "com.example.jandan"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
Expand All @@ -65,4 +65,4 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
}
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fitwallet.online">
package="com.example.jandan">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
36 changes: 22 additions & 14 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter-template">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="ImFil">
package="com.example.jandan">
<application
android:label="jandan"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize"
android:exported="true">
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
Expand All @@ -30,4 +38,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fitwallet.online
package com.example.jandan

import io.flutter.embedding.android.FlutterActivity

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fitwallet.online">
package="com.example.jandan">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,4 +26,4 @@ subprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
1 change: 0 additions & 1 deletion ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 0 additions & 1 deletion ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
41 changes: 0 additions & 41 deletions ios/Podfile

This file was deleted.

6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.fitwallet.online;
PRODUCT_BUNDLE_IDENTIFIER = com.example.jandan;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -415,7 +415,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.fitwallet.online;
PRODUCT_BUNDLE_IDENTIFIER = com.example.jandan;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -434,7 +434,7 @@
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.fitwallet.online;
PRODUCT_BUNDLE_IDENTIFIER = com.example.jandan;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>online</string>
<string>jandan</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
23 changes: 0 additions & 23 deletions lib/page/home/home.dart

This file was deleted.

86 changes: 86 additions & 0 deletions lib/page/home/homepage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:jandan/page/home/wuliao/wuliao_page.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class MyHomePage extends StatelessWidget {
MyHomePage({Key? key}) : super(key: key);
static const buttonMargin = 40.0; //左右边距
static const buttonPadding = 15.0; //按钮内部上下边距

final RefreshController _wuliaorefreshController =
RefreshController(initialRefresh: false);

@override
Widget build(BuildContext context) {
return Scaffold(
body: DefaultTabController(
length: 5,
child: NestedScrollView(
floatHeaderSlivers: true,
headerSliverBuilder: (context, innerBoxIsScrolled) {
return [
SliverAppBar(
pinned: true,
floating: true,
snap: true,
title: const Text("Jandan"),
bottom: TabBar(
tabs: const [
Tab(text: "新鲜事"),
Tab(text: "热榜"),
Tab(text: "无聊图"),
Tab(text: "随手拍"),
Tab(text: "树洞"),
],
onTap: (position) {
//TODO:双击刷新
_wuliaorefreshController.requestRefresh();
},
),
),
];
},
body: TabBarView(
children: [
const Icon(Icons.directions_car),
const Icon(Icons.directions_car),
WuliaoPage(refreshController: _wuliaorefreshController),
const Icon(Icons.directions_bike),
const Icon(Icons.directions_bike),
],
),
),
),
);
}
}



// return DefaultTabController(
// length: 5,
// child: Scaffold(
// appBar: AppBar(
// bottom: const TabBar(
// tabs: [
// Tab(text: "新鲜事"),
// Tab(text: "热榜"),
// Tab(text: "无聊图"),
// Tab(text: "随手拍"),
// Tab(text: "树洞"),
// ],
// ),
// title: const Text('Jandan'),
// ),
// body: TabBarView(
// children: [
// const Icon(Icons.directions_car),
// const Icon(Icons.directions_car),
// WuliaoPage(refreshController: _wuliaorefreshController),
// const Icon(Icons.directions_bike),
// const Icon(Icons.directions_bike),
// ],
// ),
// ),
// )
29 changes: 29 additions & 0 deletions lib/page/home/wuliao/wuliao_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class WuliaoPage extends StatelessWidget {
const WuliaoPage({Key? key, required this.refreshController})
: super(key: key);
final RefreshController refreshController;

@override
Widget build(BuildContext context) {
return SmartRefresher(
onRefresh: () {
Future.delayed(Duration(seconds: 3), () {
refreshController.refreshCompleted();
});
},
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
child: ListView.builder(
itemCount: 12,
shrinkWrap: true,
itemBuilder: (context, idx) {
return Text("asd");
}),
);
}
}
4 changes: 2 additions & 2 deletions lib/router/router_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';

import '../core/utils/log.dart';
import '../init/splash.dart';
import '../page/home/home.dart';
import '../page/home/homepage.dart';

final router = FluroRouter();

Expand All @@ -15,7 +15,7 @@ class RouteMaps {
}));
router.define("/home", handler: Handler(
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
return const MyHomePage();
return MyHomePage();
}));
}

Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/layout/position.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:online/init/themes.dart';

import '../../init/themes.dart';

extension Position on Widget {
Widget withPadding({
Expand Down
Loading

0 comments on commit 817ea28

Please sign in to comment.