Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if (flutterVersionName == null) {
}

android {
compileSdkVersion 34
ndkVersion flutter.ndkVersion
compileSdkVersion 35
ndkVersion "27.0.12077973"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -45,7 +45,7 @@ android {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 15 20:44:26 EDT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 13 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:coffee_flutter/theme/app_theme.dart';
import 'package:coffee_flutter/widgets/payment.dart';
import 'package:flutter/material.dart';
import 'package:moyasar/moyasar.dart';
import 'package:moyasar/theme/moyasar_theme.dart';

import 'widgets/coffee.dart';

Expand All @@ -13,9 +15,12 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const MaterialApp(
return MaterialApp(
theme: AppTheme.lightTheme,
darkTheme: AppTheme.darkTheme,
themeMode: ThemeMode.dark,
debugShowCheckedModeBanner: false,
home: CoffeeShop(),
home: const CoffeeShop(),
);
}
}
Expand Down Expand Up @@ -88,17 +93,19 @@ class _CoffeeShopState extends State<CoffeeShop> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: true,
body: Center(
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.9,
child: ListView(
children: [
const CoffeeImage(),
PaymentMethods(
paymentConfig: paymentConfig,
onPaymentResult: onPaymentResult,
MoyasarTheme(
data: AppTheme.darkTheme,
child: PaymentMethods(
paymentConfig: paymentConfig,
onPaymentResult: onPaymentResult,
),
),
],
),
Expand Down
92 changes: 92 additions & 0 deletions example/lib/theme/app_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// lib/core/themes/app_theme.dart

import 'package:flutter/material.dart';

class AppTheme {
const AppTheme._();

static final lightTheme = ThemeData(
brightness: Brightness.light,
primaryColor: kBackgroundColor,
visualDensity: VisualDensity.adaptivePlatformDensity,
scaffoldBackgroundColor: kBackgroundColor,
appBarTheme: AppBarTheme(
backgroundColor: kBackgroundColor,
foregroundColor: kLightTextColor,
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(foregroundColor: kLightSecondaryColor),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(kBackgroundColor),
foregroundColor: WidgetStatePropertyAll(kLightPrimaryColor))),
inputDecorationTheme: InputDecorationTheme(
fillColor: kBackgroundColor,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(color: Colors.black54, width: 3.0),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: kLightTextColor),
),
),
fontFamily: 'ElMessiri',
colorScheme: ColorScheme.light(
primary: kLightParticlesColor,
secondary: kLightSecondaryColor,
surface: kBackgroundColor,
onPrimary: kLightPrimaryColor),
);

static final darkTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: kDarkPrimaryColor,
visualDensity: VisualDensity.adaptivePlatformDensity,
scaffoldBackgroundColor: kDarkBackgroundColor,
appBarTheme: AppBarTheme(
backgroundColor: kDarkBackgroundColor,
foregroundColor: kDarkTextColor,
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(foregroundColor: kDarkTextColor),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(kDarkAccentColor),
foregroundColor: WidgetStatePropertyAll(kDarkTextColor))),
inputDecorationTheme: InputDecorationTheme(
fillColor: kDarkBackgroundColor,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: const BorderSide(color: Colors.white30, width: 1.0),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: kDarkAccentColor),
)),
fontFamily: 'ElMessiri',
colorScheme: ColorScheme.dark(
primary: kDarkBackgroundColor,
secondary: kBackgroundColor,
surface: kDarkPrimaryColor,
onPrimary: kDarkAccentColor),
);
}

Color kLightBackgroundColor = const Color(0xffffffff);
Color kBackgroundColor = const Color(0xFFFFFFFF);
Color kLightPrimaryColor =
Colors.blueGrey.shade600; //const Color.fromARGB(255, 118, 101, 179);
Color kLightSecondaryColor = const Color(0xff040415);
Color kLightParticlesColor = const Color(0x44948282);
const Color kLightTextColor = Colors.black;

Color kDarkBackgroundColor = const Color(0xFF1A2127);
Color kDarkPrimaryColor = const Color(0xFF1A2127);
Color kDarkAccentColor = Colors.blueGrey.shade600;
Color kDarkParticlesColor = const Color(0x441C2A3D);
Color kDarkTextColor = Colors.white;
10 changes: 5 additions & 5 deletions example/lib/widgets/payment.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:coffee_flutter/theme/app_theme.dart';
import 'package:flutter/material.dart';
import 'package:moyasar/moyasar.dart';

Expand Down Expand Up @@ -37,9 +38,8 @@ class PaymentMethods extends StatelessWidget {
style: ButtonStyle(
minimumSize:
const WidgetStatePropertyAll<Size>(Size.fromHeight(55)),
backgroundColor: const WidgetStatePropertyAll<Color>(
Colors.white,
),
backgroundColor:
WidgetStatePropertyAll<Color>(kLightPrimaryColor),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
Expand All @@ -56,10 +56,10 @@ class PaymentMethods extends StatelessWidget {
onPaymentResult: onPaymentResult))),
);
},
child: const Text(
child: Text(
'Pay with STC Demo',
style: TextStyle(
color: Colors.blue,
color: kBackgroundColor,
fontWeight: FontWeight.bold,
fontSize: 16,
),
Expand Down
Loading