Skip to content

Commit

Permalink
Use Listview instead
Browse files Browse the repository at this point in the history
  • Loading branch information
nizwar committed Dec 14, 2022
1 parent 9ea0be5 commit c613dcd
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 82 deletions.
59 changes: 59 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
PODS:
- Flutter (1.0.0)
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- geolocator_apple (1.2.0):
- Flutter
- path_provider_ios (0.0.1):
- Flutter
- shared_preferences_ios (0.0.1):
- Flutter
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- Toast (4.0.0)

DEPENDENCIES:
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)

SPEC REPOS:
trunk:
- FMDB
- Toast

EXTERNAL SOURCES:
Flutter:
:path: Flutter
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
geolocator_apple:
:path: ".symlinks/plugins/geolocator_apple/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.11.3
68 changes: 68 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
D047B0551139B0542218D85D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D2E35C9457985CD97892AA8 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -29,9 +30,11 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0D2E35C9457985CD97892AA8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5A1043A042156649E4B1A453 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand All @@ -42,19 +45,41 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D3521BA78658C69C811BA0E6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
D4204FADD29F8302F140CEE5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D047B0551139B0542218D85D /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1659E9201B5E5FF855303FCC /* Frameworks */ = {
isa = PBXGroup;
children = (
0D2E35C9457985CD97892AA8 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
2916ECFC7A0EAF642E568983 /* Pods */ = {
isa = PBXGroup;
children = (
5A1043A042156649E4B1A453 /* Pods-Runner.debug.xcconfig */,
D4204FADD29F8302F140CEE5 /* Pods-Runner.release.xcconfig */,
D3521BA78658C69C811BA0E6 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
Expand All @@ -72,6 +97,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
2916ECFC7A0EAF642E568983 /* Pods */,
1659E9201B5E5FF855303FCC /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -105,12 +132,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
2CB52418CA83A1AB9AF67F6C /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
DCEC92BB0E38EF3BEB3563A5 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -169,6 +198,28 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
2CB52418CA83A1AB9AF67F6C /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -197,6 +248,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
DCEC92BB0E38EF3BEB3563A5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
3 changes: 3 additions & 0 deletions ios/Runner.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 69 additions & 81 deletions lib/ui/screens/weather_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,70 +58,71 @@ class _WeatherScreenState extends State<WeatherScreen> {
),
),
Expanded(
child: NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [_weatherDetail(context, openWeather)],
body: GridView(
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 20),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1.5,
mainAxisSpacing: 10,
crossAxisSpacing: 10,
),
children: [
_boxItemWidget(
Icons.wind_power,
"Wind",
"${openWeather.wind.speed.toStringAsFixed(1)} m/s",
"Wind Deg : ${openWeather.wind.deg}°",
),
_boxItemWidget(
Icons.sunny_snowing,
"Sunrise",
DateFormat.Hm().format(unixToDateTime(openWeather.sys.sunrise) ?? DateTime.now()),
"Sunset will be at : ${DateFormat.Hm().format(unixToDateTime(openWeather.sys.sunset) ?? DateTime.now())}",
),
_boxItemWidget(
Icons.thermostat,
"Temperature",
"${openWeather.main.temp.toStringAsFixed(0)}°C",
"Feels like : ${openWeather.main.feelsLike.toStringAsFixed(0)}°C",
),
_boxItemWidget(
Icons.water_drop,
"Humidity",
"${openWeather.main.humidity}%",
"Pressure : ${openWeather.main.pressure} hPa",
),
_boxItemWidget(
Icons.cloud,
"Clouds",
"${openWeather.clouds.all}%",
"Visibility : ${openWeather.visibility / 1000} km",
),

//Conditional rain and snow
if (openWeather.rain != null)
child: ListView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 20),
children: [
_weatherDetail(context, openWeather),
const ColumnDivider(space: 20),
GridView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.5, mainAxisSpacing: 10, crossAxisSpacing: 10),
children: [
_boxItemWidget(
Icons.wind_power,
"Wind",
"${openWeather.wind.speed.toStringAsFixed(1)} m/s",
"Wind Deg : ${openWeather.wind.deg}°",
),
_boxItemWidget(
Icons.sunny_snowing,
"Sunrise",
DateFormat.Hm().format(unixToDateTime(openWeather.sys.sunrise) ?? DateTime.now()),
"Sunset will be at : ${DateFormat.Hm().format(unixToDateTime(openWeather.sys.sunset) ?? DateTime.now())}",
),
_boxItemWidget(
Icons.thermostat,
"Temperature",
"${openWeather.main.temp.toStringAsFixed(0)}°C",
"Feels like : ${openWeather.main.feelsLike.toStringAsFixed(0)}°C",
),
_boxItemWidget(
Icons.water,
"Rain",
"${openWeather.rain?.the1H ?? 0} mm",
Icons.water_drop,
"Humidity",
"${openWeather.main.humidity}%",
"Pressure : ${openWeather.main.pressure} hPa",
),
if (openWeather.snow != null)
_boxItemWidget(
Icons.snowing,
"Snow",
"${openWeather.snow?.the1H ?? 0} mm",
Icons.cloud,
"Clouds",
"${openWeather.clouds.all}%",
"Visibility : ${openWeather.visibility / 1000} km",
),

//Sea level
_boxItemWidget(
Icons.water_outlined,
"Sea Level",
"${openWeather.main.seaLevel} m",
"Ground Level : ${openWeather.main.grndLevel} m",
),
]),
//Conditional rain and snow
if (openWeather.rain != null)
_boxItemWidget(
Icons.water,
"Rain",
"${openWeather.rain?.the1H ?? 0} mm",
),
if (openWeather.snow != null)
_boxItemWidget(
Icons.snowing,
"Snow",
"${openWeather.snow?.the1H ?? 0} mm",
),

//Sea level
_boxItemWidget(
Icons.water_outlined,
"Sea Level",
"${openWeather.main.seaLevel} m",
"Ground Level : ${openWeather.main.grndLevel} m",
),
])
],
),
),
],
Expand Down Expand Up @@ -160,28 +161,15 @@ class _WeatherScreenState extends State<WeatherScreen> {
}

Widget _weatherDetail(BuildContext context, OpenWeather openWeather) {
return SliverAppBar(
centerTitle: true,
floating: false,
pinned: true,
elevation: 0,
backgroundColor: Colors.transparent,
expandedHeight: 150,
toolbarHeight: 0,
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.none,
background: Container(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Column(children: [
Text("${openWeather.main.temp.toStringAsFixed(0)}°", style: Theme.of(context).textTheme.headline2!.copyWith(color: Colors.white)),
const ColumnDivider(space: 3),
Text(openWeather.weather.first.main, style: Theme.of(context).textTheme.bodyText1!.copyWith(color: Colors.white, fontWeight: FontWeight.bold)),
const ColumnDivider(space: 5),
Text("T:${openWeather.main.tempMax.toStringAsFixed(0)}° R:${openWeather.main.tempMin.toStringAsFixed(0)}°", style: Theme.of(context).textTheme.bodyText1!.copyWith(color: Colors.white)),
]),
),
centerTitle: true,
),
return Container(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Column(children: [
Text("${openWeather.main.temp.toStringAsFixed(0)}°", style: Theme.of(context).textTheme.headline2!.copyWith(color: Colors.white)),
const ColumnDivider(space: 3),
Text(openWeather.weather.first.main, style: Theme.of(context).textTheme.bodyText1!.copyWith(color: Colors.white, fontWeight: FontWeight.bold)),
const ColumnDivider(space: 5),
Text("T:${openWeather.main.tempMax.toStringAsFixed(0)}° R:${openWeather.main.tempMin.toStringAsFixed(0)}°", style: Theme.of(context).textTheme.bodyText1!.copyWith(color: Colors.white)),
]),
);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: weather
description: Weather app CCN Task
publish_to: 'none'
version: 1.0.0+1
version: 1.0.1+1

environment:
sdk: '>=2.18.5 <3.0.0'
Expand Down

0 comments on commit c613dcd

Please sign in to comment.