80 lines
2.5 KiB
Dart
80 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
ThemeData theme({bool? useMaterial3}) {
|
|
return ThemeData(
|
|
useMaterial3: useMaterial3,
|
|
scaffoldBackgroundColor: Colors.white,
|
|
appBarTheme: appBarTheme(),
|
|
textTheme: textTheme(),
|
|
fontFamily: 'Nunito',
|
|
inputDecorationTheme: inputDecorationTheme(),
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
textSelectionTheme: const TextSelectionThemeData(
|
|
cursorColor: Color(0xFFFFC700),
|
|
),
|
|
);
|
|
}
|
|
|
|
Theme disableMaterial3({required Widget child}) {
|
|
return Theme(data: theme(useMaterial3: false), child: child);
|
|
}
|
|
|
|
Theme enableMaterial3({required Widget child}) {
|
|
return Theme(data: theme(useMaterial3: true), child: child);
|
|
}
|
|
|
|
AppBarTheme appBarTheme() {
|
|
return const AppBarTheme(
|
|
color: Colors.white,
|
|
// backwardsCompatibility: false,
|
|
systemOverlayStyle: SystemUiOverlayStyle(
|
|
statusBarColor: Colors.white,
|
|
statusBarIconBrightness: Brightness.dark,
|
|
),
|
|
|
|
surfaceTintColor: Colors.white,
|
|
elevation: 0,
|
|
// textTheme: TextTheme(
|
|
// headline6: TextStyle(color: Color(0XFF8B8B8B), fontSize: 18),
|
|
// ),
|
|
);
|
|
}
|
|
|
|
TextTheme textTheme() {
|
|
return const TextTheme(
|
|
bodyLarge: TextStyle(
|
|
color: Color(0xFF0E0F0F),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
);
|
|
}
|
|
|
|
InputDecorationTheme inputDecorationTheme() {
|
|
// OutlineInputBorder outlineInputBorder = OutlineInputBorder(
|
|
// borderRadius: BorderRadius.circular(28),
|
|
// borderSide: BorderSide(color: Pallete.textPrimary),
|
|
// gapPadding: 10,
|
|
// );
|
|
|
|
// return const InputDecorationTheme(
|
|
// // If you are using latest version of flutter then lable text and hint text shown like this
|
|
// // if you r using flutter less then 1.20.* then maybe this is not working properly
|
|
// // if we are define our floatingLabelBehavior in our theme then it's not applayed
|
|
// // floatingLabelBehavior: FloatingLabelBehavior.always,
|
|
// // contentPadding: EdgeInsets.symmetric(horizontal: 42, vertical: 20),
|
|
// // enabledBorder: outlineInputBorder,
|
|
// // focusedBorder: outlineInputBorder,
|
|
// // border: outlineInputBorder,
|
|
// );
|
|
|
|
return const InputDecorationTheme(
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: Color(0xFFFFC700), // Ganti dengan warna yang diinginkan
|
|
width: 2, // Atur lebar border sesuai kebutuhan
|
|
),
|
|
borderRadius: BorderRadius.all(Radius.circular(8))));
|
|
}
|