This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
platform specific instructions added #182
Closed
Peddinti-Sriram-Bharadwaj
wants to merge
2
commits into
flutter:main
from
Peddinti-Sriram-Bharadwaj:main
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extensions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({super.key}); | ||
|
||
// This widget is the root of your application. | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Flutter Demo', | ||
theme: ThemeData( | ||
// This is the theme of your application. | ||
// | ||
// TRY THIS: Try running your application with "flutter run". You'll see | ||
// the application has a purple toolbar. Then, without quitting the app, | ||
// try changing the seedColor in the colorScheme below to Colors.green | ||
// and then invoke "hot reload" (save your changes or press the "hot | ||
// reload" button in a Flutter-supported IDE, or press "r" if you used | ||
// the command line to start the app). | ||
// | ||
// Notice that the counter didn't reset back to zero; the application | ||
// state is not lost during the reload. To reset the state, use hot | ||
// restart instead. | ||
// | ||
// This works for code too, not just values: Most code changes can be | ||
// tested with just a hot reload. | ||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | ||
useMaterial3: true, | ||
), | ||
home: const MyHomePage(title: 'Flutter Demo Home Page'), | ||
); | ||
} | ||
} | ||
|
||
class MyHomePage extends StatefulWidget { | ||
const MyHomePage({super.key, required this.title}); | ||
|
||
// This widget is the home page of your application. It is stateful, meaning | ||
// that it has a State object (defined below) that contains fields that affect | ||
// how it looks. | ||
|
||
// This class is the configuration for the state. It holds the values (in this | ||
// case the title) provided by the parent (in this case the App widget) and | ||
// used by the build method of the State. Fields in a Widget subclass are | ||
// always marked "final". | ||
|
||
final String title; | ||
|
||
@override | ||
State<MyHomePage> createState() => _MyHomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<MyHomePage> { | ||
int _counter = 0; | ||
|
||
void _incrementCounter() { | ||
setState(() { | ||
// This call to setState tells the Flutter framework that something has | ||
// changed in this State, which causes it to rerun the build method below | ||
// so that the display can reflect the updated values. If we changed | ||
// _counter without calling setState(), then the build method would not be | ||
// called again, and so nothing would appear to happen. | ||
_counter++; | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
// This method is rerun every time setState is called, for instance as done | ||
// by the _incrementCounter method above. | ||
// | ||
// The Flutter framework has been optimized to make rerunning build methods | ||
// fast, so that you can just rebuild anything that needs updating rather | ||
// than having to individually change instances of widgets. | ||
return Scaffold( | ||
appBar: AppBar( | ||
// TRY THIS: Try changing the color here to a specific color (to | ||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar | ||
// change color while the other colors stay the same. | ||
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | ||
// Here we take the value from the MyHomePage object that was created by | ||
// the App.build method, and use it to set our appbar title. | ||
title: Text(widget.title), | ||
), | ||
body: Center( | ||
// Center is a layout widget. It takes a single child and positions it | ||
// in the middle of the parent. | ||
child: Column( | ||
// Column is also a layout widget. It takes a list of children and | ||
// arranges them vertically. By default, it sizes itself to fit its | ||
// children horizontally, and tries to be as tall as its parent. | ||
// | ||
// Column has various properties to control how it sizes itself and | ||
// how it positions its children. Here we use mainAxisAlignment to | ||
// center the children vertically; the main axis here is the vertical | ||
// axis because Columns are vertical (the cross axis would be | ||
// horizontal). | ||
// | ||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" | ||
// action in the IDE, or press "p" in the console), to see the | ||
// wireframe for each widget. | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
const Text( | ||
'You have pushed the button this many times:', | ||
), | ||
Text( | ||
'$_counter', | ||
style: Theme.of(context).textTheme.headlineMedium, | ||
), | ||
], | ||
), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: _incrementCounter, | ||
tooltip: 'Increment', | ||
child: const Icon(Icons.add), | ||
), // This trailing comma makes auto-formatting nicer for build methods. | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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:super_dash/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); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
flutter/ephemeral/ | ||
|
||
# Visual Studio user-specific files. | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Visual Studio build-related files. | ||
x64/ | ||
x86/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Project-level configuration. | ||
cmake_minimum_required(VERSION 3.14) | ||
project(super_dash LANGUAGES CXX) | ||
|
||
# The name of the executable created for the application. Change this to change | ||
# the on-disk name of your application. | ||
set(BINARY_NAME "super_dash") | ||
|
||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent | ||
# versions of CMake. | ||
cmake_policy(VERSION 3.14...3.25) | ||
|
||
# Define build configuration option. | ||
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | ||
if(IS_MULTICONFIG) | ||
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" | ||
CACHE STRING "" FORCE) | ||
else() | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
set(CMAKE_BUILD_TYPE "Debug" CACHE | ||
STRING "Flutter build mode" FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
"Debug" "Profile" "Release") | ||
endif() | ||
endif() | ||
# Define settings for the Profile build mode. | ||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") | ||
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") | ||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") | ||
|
||
# Use Unicode for all projects. | ||
add_definitions(-DUNICODE -D_UNICODE) | ||
|
||
# Compilation settings that should be applied to most targets. | ||
# | ||
# Be cautious about adding new options here, as plugins use this function by | ||
# default. In most cases, you should add new options to specific targets instead | ||
# of modifying this function. | ||
function(APPLY_STANDARD_SETTINGS TARGET) | ||
target_compile_features(${TARGET} PUBLIC cxx_std_17) | ||
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") | ||
target_compile_options(${TARGET} PRIVATE /EHsc) | ||
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") | ||
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>") | ||
endfunction() | ||
|
||
# Flutter library and tool build rules. | ||
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") | ||
add_subdirectory(${FLUTTER_MANAGED_DIR}) | ||
|
||
# Application build; see runner/CMakeLists.txt. | ||
add_subdirectory("runner") | ||
|
||
|
||
# Generated plugin build rules, which manage building the plugins and adding | ||
# them to the application. | ||
include(flutter/generated_plugins.cmake) | ||
|
||
|
||
# === Installation === | ||
# Support files are copied into place next to the executable, so that it can | ||
# run in place. This is done instead of making a separate bundle (as on Linux) | ||
# so that building and running from within Visual Studio will work. | ||
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>") | ||
# Make the "install" step default, as it's required to run. | ||
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) | ||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) | ||
endif() | ||
|
||
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") | ||
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") | ||
|
||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
COMPONENT Runtime) | ||
|
||
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
COMPONENT Runtime) | ||
|
||
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
COMPONENT Runtime) | ||
|
||
if(PLUGIN_BUNDLED_LIBRARIES) | ||
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" | ||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
COMPONENT Runtime) | ||
endif() | ||
|
||
# Copy the native assets provided by the build.dart from all packages. | ||
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") | ||
install(DIRECTORY "${NATIVE_ASSETS_DIR}" | ||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
COMPONENT Runtime) | ||
|
||
# Fully re-copy the assets directory on each build to avoid having stale files | ||
# from a previous install. | ||
set(FLUTTER_ASSET_DIR_NAME "flutter_assets") | ||
install(CODE " | ||
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") | ||
" COMPONENT Runtime) | ||
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" | ||
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) | ||
|
||
# Install the AOT library on non-Debug builds only. | ||
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
CONFIGURATIONS Profile;Release | ||
COMPONENT Runtime) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add
!kIsWeb
in this condition?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it is possible that people open the app in browser but on a android or iOs or windows, opening the tab as in 'desktop view'. So, I believed that adding this condition would help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood the fallacy in my logic. It must show 'tap to start' even if the app were to be opened in a smartphone weather it is browser or mobile app. I shall revise the logic again sir. Thank you for your review.
Shall I make the following changes and pull again?