Open berkeresvan opened 6 months ago
import 'package:flutter/material.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.transparent), useMaterial3: true, ), home: const MyHomePage(title: 'AppBar Arama'), debugShowCheckedModeBanner: false, ); } }
class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title});
final String title;
@override State createState() => _MyHomePageState(); }
class _MyHomePageState extends State { bool aramaYapiliyorMu = false;
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: aramaYapiliyorMu ? TextField( decoration: InputDecoration(hintText: "Arama İçin Birşey Yazın"), onChanged: (aramaSonucu) { print("Arama Sonucu : $aramaSonucu"); }, ) : Text("AppBar Arama"), actions: [ aramaYapiliyorMu ? IconButton( onPressed: () { setState(() { aramaYapiliyorMu = false; }); }, icon: Icon(Icons.cancel)) : IconButton( onPressed: () { setState(() { aramaYapiliyorMu = true; }); }, icon: Icon(Icons.search)) ], ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [], ), ), ); } }
import 'package:flutter/material.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.transparent), useMaterial3: true, ), home: const MyHomePage(title: 'AppBar Arama'), debugShowCheckedModeBanner: false, ); } }
class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title});
final String title;
@override State createState() => _MyHomePageState();
}
class _MyHomePageState extends State {
bool aramaYapiliyorMu = false;
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: aramaYapiliyorMu ? TextField( decoration: InputDecoration(hintText: "Arama İçin Birşey Yazın"), onChanged: (aramaSonucu) { print("Arama Sonucu : $aramaSonucu"); }, ) : Text("AppBar Arama"), actions: [ aramaYapiliyorMu ? IconButton( onPressed: () { setState(() { aramaYapiliyorMu = false; }); }, icon: Icon(Icons.cancel)) : IconButton( onPressed: () { setState(() { aramaYapiliyorMu = true; }); }, icon: Icon(Icons.search)) ], ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [], ), ), ); } }