-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor: move demo app into 'app' folder * refactor: rename demo project to ouds_flutter_demo * chore: create and add ouds_flutter library * chore: create OudsTheme and configure with demo app * refactor: move notice and third_party files * chore: add orange color schemes (light/dark) * chore: add theme class for OUDS themes * chore: implement theme switching in demo app * chore: set up navigation bar in demo app * chore: add ic_palette icon and update NOTICE file
- Loading branch information
1 parent
090274e
commit 31d2f7d
Showing
100 changed files
with
938 additions
and
241 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release |
File renamed without changes.
File renamed without changes.
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,16 @@ | ||
# ouds_flutter | ||
|
||
A new Flutter project. | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter application. | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) | ||
|
||
For help getting started with Flutter development, view the | ||
[online documentation](https://docs.flutter.dev/), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
|
@@ -22,4 +22,4 @@ plugins { | |
id "org.jetbrains.kotlin.android" version "1.8.22" apply false | ||
} | ||
|
||
include ":lib" | ||
include ":app" |
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
108 changes: 54 additions & 54 deletions
108
ios/Runner.xcodeproj/project.pbxproj → app/ios/Runner.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,66 @@ | ||
/* | ||
* Software Name : OUDS Flutter | ||
* SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This software is distributed under the MIT license, | ||
* the text of which is available at https://opensource.org/license/MIT/ | ||
* or see the "LICENSE" file for more details. | ||
* | ||
* Software description: Flutter library of reusable graphical components for Android and iOS | ||
*/ | ||
|
||
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/ouds_flutter_app_localizations.dart'; | ||
import 'package:flutter_localizations/flutter_localizations.dart'; | ||
import 'package:get/get_navigation/src/root/get_material_app.dart'; | ||
import 'package:ouds_flutter_demo/ui/main_screen.dart'; | ||
import 'package:ouds_flutter_demo/ui/theme/theme_controller.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
void main() { | ||
runApp(OudsApplication()); | ||
} | ||
|
||
class OudsApplication extends StatefulWidget { | ||
const OudsApplication({super.key}); | ||
|
||
@override | ||
State<OudsApplication> createState() => _OudsApplicationState(); | ||
} | ||
|
||
class _OudsApplicationState extends State<OudsApplication> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ChangeNotifierProvider( | ||
create: (_) => ThemeController(), | ||
child: Consumer<ThemeController>( | ||
builder: (context, themeController, child) { | ||
return GetMaterialApp( | ||
title: 'OudsPlayground - Flutter', | ||
debugShowCheckedModeBanner: false, | ||
theme: themeController.currentTheme, | ||
darkTheme: themeController.currentDarkTheme, | ||
themeMode: ThemeMode.system, | ||
home: MainScreen(), | ||
// Localization setup | ||
supportedLocales: AppLocalizations.supportedLocales, | ||
localizationsDelegates: [ | ||
AppLocalizations.delegate, | ||
GlobalMaterialLocalizations.delegate, | ||
GlobalCupertinoLocalizations.delegate, | ||
GlobalWidgetsLocalizations.delegate, | ||
], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
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,39 @@ | ||
/* | ||
* Software Name : OUDS Flutter | ||
* SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This software is distributed under the MIT license, | ||
* the text of which is available at https://opensource.org/license/MIT/ | ||
* or see the "LICENSE" file for more details. | ||
* | ||
* Software description: Flutter library of reusable graphical components for Android and iOS | ||
*/ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ouds_flutter_demo/ui/theme/theme_selector.dart'; | ||
|
||
class MainAppBar extends StatelessWidget implements PreferredSizeWidget { | ||
final String title; | ||
final bool showBackButton; | ||
|
||
const MainAppBar({ | ||
super.key, | ||
required this.title, | ||
this.showBackButton = false, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AppBar( | ||
title: Text(title), | ||
leading: showBackButton ? const BackButton() : null, | ||
actions: const [ | ||
ThemeSelector(), | ||
], | ||
); | ||
} | ||
|
||
@override | ||
Size get preferredSize => const Size.fromHeight(kToolbarHeight); | ||
} |
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
File renamed without changes.
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,71 @@ | ||
/* | ||
* Software Name : OUDS Flutter | ||
* SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This software is distributed under the MIT license, | ||
* the text of which is available at https://opensource.org/license/MIT/ | ||
* or see the "LICENSE" file for more details. | ||
* | ||
* Software description: Flutter library of reusable graphical components for Android and iOS | ||
*/ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ouds_flutter_demo/main_app_bar.dart'; | ||
import 'package:ouds_flutter_demo/ui/utilities/navigation_items.dart'; | ||
|
||
class MainScreen extends StatefulWidget { | ||
const MainScreen({super.key}); | ||
|
||
@override | ||
State<MainScreen> createState() => _MainScreenState(); | ||
} | ||
|
||
class _MainScreenState extends State<MainScreen> { | ||
int _selectedIndex = 0; | ||
NavigationItems get _navigationItems => NavigationItems(context); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var selectedItem = _navigationItems.getSelectedMenuItem(_selectedIndex); | ||
|
||
return Scaffold( | ||
appBar: MainAppBar(title: selectedItem.label), | ||
bottomNavigationBar: _buildBottomNavigationBar(), | ||
body: Row( | ||
children: [ | ||
if (MediaQuery.of(context).size.width >= 640) _buildNavigationRail(), | ||
Expanded( | ||
child: _navigationItems.getScreens(_selectedIndex), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
|
||
Widget _buildBottomNavigationBar() { | ||
return MediaQuery.of(context).size.width < 640 | ||
? NavigationBar( | ||
selectedIndex: _selectedIndex, | ||
onDestinationSelected: (int index) { | ||
setState(() { | ||
_selectedIndex = index; | ||
}); | ||
}, | ||
destinations: _navigationItems.getBottomNavigationBarItems(), | ||
) | ||
: const SizedBox.shrink(); | ||
} | ||
|
||
Widget _buildNavigationRail() { | ||
return NavigationRail( | ||
selectedIndex: _selectedIndex, | ||
onDestinationSelected: (int index) { | ||
setState(() { | ||
_selectedIndex = index; | ||
}); | ||
}, | ||
destinations: _navigationItems.getNavigationRailDestinations(), | ||
); | ||
} | ||
} |
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,37 @@ | ||
/* | ||
* Software Name : OUDS Flutter | ||
* SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This software is distributed under the MIT license, | ||
* the text of which is available at https://opensource.org/license/MIT/ | ||
* or see the "LICENSE" file for more details. | ||
* | ||
* Software description: Flutter library of reusable graphical components for Android and iOS | ||
*/ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ouds_flutter/core/ouds_theme.dart'; | ||
|
||
class ThemeController extends ChangeNotifier { | ||
bool _isOrangeTheme = true; | ||
|
||
bool get isOrangeTheme => _isOrangeTheme; | ||
|
||
void setTheme(bool isOrange) { | ||
_isOrangeTheme = isOrange; | ||
notifyListeners(); | ||
} | ||
|
||
ThemeData get currentTheme { | ||
return _isOrangeTheme | ||
? OudsTheme.orangeThemeLight | ||
: OudsTheme.inverseThemeLight; | ||
} | ||
|
||
ThemeData get currentDarkTheme { | ||
return _isOrangeTheme | ||
? OudsTheme.orangeThemeDark | ||
: OudsTheme.inverseThemeDark; | ||
} | ||
} |
Oops, something went wrong.