From Blueprints to Beautiful Screens — Mobile Architecture, UI/UX & Responsive Design!
ব্লুপ্রিন্ট থেকে সুন্দর স্ক্রিন — মোবাইল আর্কিটেকচার, UI/UX ও রেসপন্সিভ ডিজাইন!
These past few sessions have been a whirlwind of ideas — and honestly, some of the most eye-opening content I've come across in my "Mobile Platform for IoT Devices" course. We covered three big topics: how mobile apps are structured on the inside, how they should look and feel for the user, and how they should adapt to every screen size imaginable. Let me walk you through everything I learned, the way it actually clicked in my head!
📐 Mobile Application Architecture
Why Architecture Even Matters
Before writing a single line of code for a mobile app, you need a plan — a blueprint for how everything will fit together. That plan is called architecture. Choose the wrong one, and your app becomes a nightmare to update, scale, or fix. A staggering 21% of millennials open an app 50+ times per day — that kind of pressure demands a rock-solid foundation!
The Three Layers of Every Mobile App
Think of a mobile app like a restaurant. There's the dining area where customers sit (Presentation Layer), the kitchen where food gets prepared (Business Layer), and the cold storage where ingredients are kept (Data Layer). Each one has a specific job:
1. Presentation Layer This is what the user actually sees and touches. It handles the UI (how it looks) and the UX (how it feels to use). Its job is to show data, accept user input, and navigate between screens.
2. Business Layer This is the brains of the operation. It processes what the user does, applies all the rules and logic, and validates data. For example, this layer makes sure a product price can never accidentally go negative. It's further split into:
- Service Layer — talks to APIs and the backend
- Domain Layer — holds the core business rules
- Controller Layer — coordinates between the Presentation and Domain layers
3. Data Layer This is the storage and memory of the app. It stores data locally, fetches data from servers, caches things for speed, and keeps everything in sync.
The Big Architecture Patterns
Now, how you organize these three layers is where the different architecture patterns come in.
MVC — Model, View, Controller Real-life example: Think of a newspaper. The raw news (Model), the printed page layout (View), and the editor who decides what goes where (Controller).
The Controller sits in the middle and connects everything. Great for small, simple apps with a small team. The downside? The Controller can get bloated and messy as the app grows.
MVP — Model, View, Presenter Real-life example: Same newspaper, but now the editor (Presenter) does all the decision-making, and the printed page (View) just follows orders passively — it has zero opinion of its own.
The View becomes completely passive here. This makes it far easier to test the logic independently. Best for apps with complex UIs.
MVVM — Model, View, ViewModel Real-life example: Imagine a smart TV connected to a streaming service. The show content is the Model, the TV screen is the View, and a smart remote control is the ViewModel — it automatically syncs whatever you pick with what appears on the screen, without you needing to do anything manually.
The magic here is two-way data binding — when the data changes, the screen updates automatically, and vice versa. This is the go-to pattern for Flutter, Android Jetpack, and any reactive UI framework. Highly testable, highly scalable.
Beyond the "Presentation Layer" Patterns
Clean Architecture Real-life example: An onion. The innermost layer (the business rules) doesn't care what's happening on the outer layers — the UI, the database, the framework. You can completely swap out the UI and the core logic won't even flinch.
This is how apps like Uber are built — the ride-matching logic (fare calculation, driver matching) is completely isolated from whether you're on Android, iOS, or the web.
Modular Architecture Real-life example: LEGO blocks. Each block (module) is self-contained and can be snapped in or taken out without breaking the rest.
Spotify uses this — the Playback, Search, Profile, and Social Sharing modules are all independent. Different teams can work on different modules at the same time.
Monolithic Architecture Real-life example: A one-room house where the kitchen, bedroom, and living room are all in the same space. Easy to build at first, but impossible to renovate later.
This is how early Instagram was built — everything bundled together. Simple to start with, but it becomes a nightmare as the app grows.
Choosing Wrong = Paying the Price
Pick the wrong architecture and you'll face: inflexibility to new features, skyrocketing maintenance costs, poor performance, and difficulty scaling. Always consider your project goals, budget, timeline, scalability needs, and security requirements before deciding.
🎨 Mobile UI/UX Design Principles
What Even Is Mobile App Design?
With over 4 million apps across iOS and Android, the ones people actually keep using are the ones with great design. Instagram had 696 million downloads in 2023 alone — and a huge part of that is its clean, intuitive interface. And here's a sobering stat: 73% of customers say experience is an important factor in making a purchase.
Design isn't just about making things pretty. It's about making things work beautifully.
UI (User Interface) → How the app looks: colors, typography, icons, layout, whitespace. UX (User Experience) → How the app feels: navigation flow, accessibility, animations, feedback.
UI Design Principles
1. Simplicity Real-life example: A well-designed elevator panel. Only the floor buttons you need, nothing extra.
On a small mobile screen, every pixel counts. Cut the clutter, remove the unnecessary, and let the important things breathe.
2. Consistency Real-life example: A brand's style guide. Whether it's a billboard, a brochure, or an app — the same colors, fonts, and tone everywhere.
Use consistent colors, fonts, icons, and navigation patterns throughout. This builds familiarity and trust. Trello is a great example — same card layouts, same drag-and-drop behavior across every board.
3. Feedback and Response Time Real-life example: When you press a button on a TV remote, the tiny red LED blinks to confirm your press was registered.
Users expect instant feedback. Loading spinners, button press animations, success/error messages — these small things make a huge difference in how polished an app feels.
UX Design Principles
4. Usability Real-life example: A well-designed door — you can immediately tell whether to push or pull just by looking at the handle.
If users have to think about how to use your app, you've already lost them. Google Maps gets this right — tap targets are large enough to press even while walking, and gestures like pinch-to-zoom follow universal conventions.
5. User-Centric Design Real-life example: A tailor who measures the customer first, then cuts the cloth — not the other way around.
Design for the user, not for yourself. Involve real users from the research phase all the way through to testing. Airbnb does this brilliantly — the booking flow is structured around exactly how users think about travel, not how Airbnb's database is organized.
6. Accessibility Real-life example: A public building with ramps, wide doors, and braille signs — designed so everyone can use it, not just the majority.
Design for users with visual, auditory, motor, and cognitive differences. This means: sufficient color contrast, readable font sizes, alternative text for images, screen reader support, and voice navigation. Apple's iOS sets the gold standard here with VoiceOver, dynamic text resizing, and color filters.
The 7 Visual Design Concepts
7. Hierarchy — Guide the user's eye to what matters most using size, color, and spacing. Amazon does this perfectly: product image → title → price → "Add to Cart" button. Your eye follows that path naturally.
8. Progressive Disclosure — Don't dump everything on the screen at once. Show what's essential first, reveal more only when needed. Airbnb shows basic filters (location, dates) first — advanced filters only appear if you go looking for them.
9. Contrast — Make sure text and background colors are different enough to read easily. Google Search uses strong contrast between text and background, especially in dark mode.
10. Proximity — Group related things together. Instagram puts Like, Comment, and Share buttons directly below each post — you instantly know they belong to that post.
11. Alignment — Line things up to a grid. Spotify aligns album covers, playlists, and controls along a clean, consistent grid. It looks effortlessly polished.
Design Tools Worth Knowing
- Figma — Cloud-based, real-time collaboration, great for teams
- Sketch — Popular vector tool for wireframes and mockups
- Adobe XD — Interactive prototypes with responsive design support
- InVision — Great for prototyping and stakeholder feedback
- Axure RP — Advanced interactive prototypes with complex animations
📱 Adaptive & Responsive Design for Mobile Screens
The Core Problem
Your app will be used on a tiny budget phone, a large flagship phone, a tablet, and maybe even a foldable screen. How do you make it look great on all of them? That's exactly what this final topic was about.
There are two main approaches, and they're very different from each other.
Responsive Design
Real-life example: Water. Pour it into a tall glass, a wide bowl, or a round cup — it always fills the shape of whatever container it's in.
Responsive design uses flexible grids, fluid images, and CSS media queries to make one single layout automatically adjust to any screen size.
Advantages:
- One codebase for all devices → easier to maintain
- Better SEO (Google favors responsive design)
- Consistent experience across devices
Disadvantages:
- Loads all elements even if they're not needed on a small screen → can be slower
- More complex to plan and implement correctly
Adaptive Design
Real-life example: A tailor who keeps multiple pre-made suit sizes in the shop. When a customer comes in, they pick the size closest to the customer's measurements.
Adaptive design uses multiple pre-built layouts — one for phones, one for tablets, one for desktops — and serves the right one based on the detected device.
Advantages:
- Faster performance (only loads what's needed for that device)
- More precise control over how the app looks on each device
- Allows a truly custom experience per platform
Disadvantages:
- More code to maintain (multiple versions)
- Can complicate SEO if different URLs are used per layout
When to Use Which?
| Responsive | Adaptive | |
|---|---|---|
| Best for | Blogs, news apps, portfolios | Games, performance-critical apps |
| Codebase | Single | Multiple |
| Maintenance | Easier | More effort |
| Performance | Can be slower | Faster |
| Control | Less precise | More precise |
The simple rule: Choose Responsive for flexibility and broad reach. Choose Adaptive for performance and precision.
Key Technical Concepts
Fluid vs Fixed Layouts
- Fluid uses percentage-based widths (e.g.,
width: 80%) — adapts smoothly to any screen - Fixed uses pixel-based widths (e.g.,
width: 360px) — stays the same regardless of screen size
Breakpoints Define specific screen width thresholds where the layout changes. Common breakpoints: 480px (small phone), 768px (tablet), 1024px (desktop). CSS media queries apply different styles at each breakpoint.
Device Detection (Adaptive) Server-side or client-side logic detects what kind of device is being used, then loads the appropriate layout or assets.
Flutter Makes This Easy
Flutter has dedicated widgets for both approaches:
Responsive Widgets in Flutter:
| Widget | What it does |
|---|---|
MediaQuery |
Gets screen size, orientation, pixel density |
LayoutBuilder |
Builds widgets based on available space |
Flexible / Expanded |
Adjusts child size within Row/Column |
Wrap |
Automatically wraps children to next line |
OrientationBuilder |
Different layouts for portrait vs landscape |
FractionallySizedBox |
Sizes child relative to parent (e.g., 80% width) |
Adaptive Widgets in Flutter:
| Widget | What it does |
|---|---|
Platform.isAndroid / .isIOS |
Detect platform for conditional logic |
CupertinoPageScaffold |
iOS-style layout |
Scaffold |
Material/Android-style layout |
Switch.adaptive |
Renders the right switch for each platform |
AppBar |
Automatically adapts to platform styling |
Wrapping Up — The Big Picture
Three lectures in, and the pattern is becoming clear. Building a great mobile app isn't just about writing good code — it's about:
- Choosing the right architecture so your app doesn't fall apart as it grows
- Designing for real humans so your app is intuitive, beautiful, and accessible to everyone
- Adapting to every screen so your app feels great whether someone's on a budget phone or a high-end tablet
These aren't just exam topics — these are the real decisions that separate apps people love from apps people delete.
🌍 Connect with me:
- Blog: https://blog.naimurrashid.dev/
- Portfolio: https://naimurrashid.dev/
গত কয়েকটা লেকচার ছিল সত্যিকারের চোখ খুলে দেওয়ার মতো! "Mobile Platform for IoT Devices" কোর্সে আমরা তিনটা বড় বিষয় কভার করলাম — মোবাইল অ্যাপের ভেতরের কাঠামো কেমন হওয়া উচিত, ব্যবহারকারীর কাছে সেটা দেখতে ও ব্যবহারে কেমন লাগা উচিত, আর বিভিন্ন স্ক্রিন সাইজে সেটা কীভাবে মানিয়ে নেবে। চলো, পুরো বিষয়টা ঠিক যেভাবে আমার মাথায় ক্লিক করেছে সেভাবেই বলি!
📐 মোবাইল অ্যাপ্লিকেশন আর্কিটেকচার
আর্কিটেকচার কেন দরকার?
কোড লেখার আগে একটা পরিকল্পনা দরকার — অ্যাপের সব অংশ কীভাবে একসাথে কাজ করবে তার একটা ছক। এই ছকটাই হলো আর্কিটেকচার। ভুল আর্কিটেকচার বেছে নিলে পরে অ্যাপ আপডেট করা, বড় করা বা সমস্যা ঠিক করা সব কিছুই দুঃস্বপ্ন হয়ে যায়!
মোবাইল অ্যাপের তিনটা Layer
মোবাইল অ্যাপকে একটা রেস্টুরেন্টের সাথে তুলনা করো। ডাইনিং রুম (Presentation Layer), রান্নাঘর (Business Layer) আর গুদামঘর (Data Layer)।
১. Presentation Layer (উপস্থাপনা স্তর) এটাই ব্যবহারকারী সরাসরি দেখে ও স্পর্শ করে। UI (দেখতে কেমন) ও UX (ব্যবহার করতে কেমন লাগে) এখানেই থাকে। ডেটা দেখানো, ইনপুট নেওয়া এবং স্ক্রিনের মধ্যে নেভিগেট করা এর কাজ।
২. Business Layer (লজিক স্তর) এটা অ্যাপের মগজ। ব্যবহারকারী কী করল তা প্রসেস করে, নিয়মকানুন প্রয়োগ করে, ডেটা যাচাই করে। এটা আবার ভাগ হয়:
- Service Layer — API ও ব্যাকএন্ডের সাথে কথা বলে
- Domain Layer — মূল ব্যবসায়িক নিয়ম ধরে রাখে
- Controller Layer — Presentation ও Domain Layer-এর মধ্যে সমন্বয় করে
৩. Data Layer (ডেটা স্তর) অ্যাপের স্টোরেজ ও স্মৃতি। ডেটা সংরক্ষণ করে, সার্ভার থেকে আনে, ক্যাশ করে এবং সব কিছু সিঙ্ক রাখে।
বড় আর্কিটেকচার প্যাটার্নগুলো
MVC — Model, View, Controller বাস্তব উদাহরণ: একটা পত্রিকা কল্পনা করো। কাঁচা খবর (Model), ছাপানো পাতার লেআউট (View), আর সম্পাদক যিনি ঠিক করেন কোথায় কী যাবে (Controller)।
Controller মাঝখানে থেকে সব কিছু সংযুক্ত করে। ছোট ও সহজ অ্যাপের জন্য দারুণ। সমস্যা হলো, অ্যাপ বড় হলে Controller ফুলে-ফেঁপে এলোমেলো হয়ে যায়।
MVP — Model, View, Presenter বাস্তব উদাহরণ: একই পত্রিকা, কিন্তু এখন সম্পাদক (Presenter) সব সিদ্ধান্ত নেন, আর ছাপানো পাতা (View) শুধু নির্দেশ মেনে চলে — নিজের কোনো মতামত নেই।
View এখানে সম্পূর্ণ নিষ্ক্রিয়। এতে লজিক স্বাধীনভাবে পরীক্ষা করা অনেক সহজ হয়। জটিল UI-এর অ্যাপের জন্য আদর্শ।
MVVM — Model, View, ViewModel বাস্তব উদাহরণ: একটা স্মার্ট টিভি আর স্ট্রিমিং সার্ভিসের কথা ভাবো। শোয়ের কন্টেন্ট হলো Model, টিভি স্ক্রিন হলো View, আর স্মার্ট রিমোট হলো ViewModel — তুমি কী বেছে নিলে সেটা স্বয়ংক্রিয়ভাবে স্ক্রিনে আসে, আলাদা করে কিছু করতে হয় না।
এখানে যাদু হলো দুইমুখী ডেটা বাইন্ডিং — ডেটা বদলালে স্ক্রিন আপনা-আপনি আপডেট হয়। Flutter, Android Jetpack-সহ যেকোনো reactive UI ফ্রেমওয়ার্কের জন্য এটাই সেরা পছন্দ।
অন্যান্য আর্কিটেকচার প্যাটার্ন
Clean Architecture বাস্তব উদাহরণ: পেঁয়াজ। সবচেয়ে ভেতরের স্তরটা (ব্যবসায়িক নিয়ম) বাইরের স্তরের — UI, ডেটাবেস, ফ্রেমওয়ার্ক — কিছুর পরোয়া করে না। UI পুরো বদলে দিলেও ভেতরের লজিকের কিছুই হয় না।
Uber-এর মতো অ্যাপ এভাবেই বানানো — রাইড ম্যাচিং লজিক Android, iOS বা ওয়েব — সব প্ল্যাটফর্মে একই থাকে।
Modular Architecture বাস্তব উদাহরণ: LEGO ব্লক। প্রতিটা ব্লক (module) স্বয়ংসম্পূর্ণ — একটা খুলে নিলে বাকি সব ঠিকঠাক থাকে।
Spotify এভাবেই কাজ করে — Playback, Search, Profile, Social Sharing — সব আলাদা মডিউল, আলাদা টিম।
Monolithic Architecture বাস্তব উদাহরণ: একটা এক-কামরার বাসা যেখানে রান্নাঘর, শোবার ঘর আর বসার ঘর একসাথে। প্রথমে বানাতে সহজ, কিন্তু পরে সংস্কার করা মুশকিল।
এভাবেই পুরনো Instagram বানানো হয়েছিল। শুরুতে সহজ, কিন্তু বড় হওয়ার সাথে সাথে nightmare হয়ে যায়।
ভুল আর্কিটেকচার = ভবিষ্যতে বিপদ
প্রজেক্টের লক্ষ্য, বাজেট, সময়, scalability এবং নিরাপত্তার চাহিদা — এগুলো ভেবে তারপর সিদ্ধান্ত নাও। ভুল বেছে নিলে ভবিষ্যতে নতুন ফিচার যোগ করা কঠিন হয়, খরচ বাড়ে, পারফরম্যান্স কমে।
🎨 মোবাইল UI/UX ডিজাইন নীতি
মোবাইল অ্যাপ ডিজাইন আসলে কী?
iOS ও Android মিলিয়ে ৪০ লক্ষেরও বেশি অ্যাপ আছে — কিন্তু মানুষ বারবার ব্যবহার করে মাত্র হাতেগোনা কয়েকটা। Instagram ২০২৩ সালে একাই ৬৯ কোটি ৬০ লাখ বার ডাউনলোড হয়েছে। আর ৭৩% গ্রাহক বলেন, কেনাকাটার সিদ্ধান্তে experience গুরুত্বপূর্ণ ভূমিকা রাখে।
ডিজাইন মানে শুধু সুন্দর দেখানো না — ডিজাইন মানে সুন্দরভাবে কাজ করা।
UI (User Interface) → অ্যাপ দেখতে কেমন: রঙ, typography, icon, লেআউট, whitespace। UX (User Experience) → অ্যাপ ব্যবহার করতে কেমন লাগে: নেভিগেশন, accessibility, অ্যানিমেশন, ফিডব্যাক।
UI ডিজাইনের নীতি
১. Simplicity (সরলতা) বাস্তব উদাহরণ: একটা ভালো ডিজাইনের লিফটের বোতাম প্যানেল। শুধু যেটুকু দরকার, বাড়তি কিছু নেই।
ছোট মোবাইল স্ক্রিনে প্রতিটা পিক্সেল মূল্যবান। অপ্রয়োজনীয় জিনিস বাদ দাও, গুরুত্বপূর্ণ জিনিসকে জায়গা দাও।
২. Consistency (সামঞ্জস্য) বাস্তব উদাহরণ: একটা ব্র্যান্ডের স্টাইল গাইড। বিলবোর্ড হোক, ব্রোশার হোক বা অ্যাপ — সব জায়গায় একই রঙ, font, ভাষা।
সব স্ক্রিনে একই রঙ, font, icon এবং navigation pattern রাখো। Trello এর সেরা উদাহরণ — সব বোর্ডে একই কার্ড লেআউট, একই drag-and-drop।
৩. Feedback and Response Time (প্রতিক্রিয়া) বাস্তব উদাহরণ: TV রিমোটের বোতাম চাপলে ছোট্ট LED জ্বলে ওঠে — নিশ্চিত করে যে চাপ রেজিস্টার হয়েছে।
ব্যবহারকারী তাৎক্ষণিক সাড়া চায়। Loading spinner, বোতাম চাপার অ্যানিমেশন, সফলতা/ত্রুটির বার্তা — এই ছোট ছোট জিনিসগুলো অ্যাপকে polished করে তোলে।
UX ডিজাইনের নীতি
৪. Usability (ব্যবহারযোগ্যতা) বাস্তব উদাহরণ: একটা ভালো ডিজাইনের দরজা — হাতলটা দেখেই বোঝা যায় ঠেলতে হবে নাকি টানতে হবে।
ব্যবহারকারীকে যদি ভাবতে হয় কীভাবে অ্যাপ চালাতে হবে, তাহলে ডিজাইন ব্যর্থ। Google Maps এটা ঠিকঠাক করে — চলতে চলতেও চাপা যায় এমন বড় বোতাম, সর্বজনীন pinch-to-zoom gesture।
৫. User-Centric Design (ব্যবহারকারীকেন্দ্রিক ডিজাইন) বাস্তব উদাহরণ: একজন দর্জি যিনি আগে মাপ নেন, তারপর কাপড় কাটেন — উল্টোটা নয়।
ব্যবহারকারীর জন্য ডিজাইন করো, নিজের পছন্দের জন্য নয়। গবেষণা থেকে শুরু করে টেস্টিং পর্যন্ত ব্যবহারকারীদের সাথে রাখো। Airbnb এটার সেরা উদাহরণ।
৬. Accessibility (প্রবেশযোগ্যতা) বাস্তব উদাহরণ: র্যাম্প, চওড়া দরজা আর ব্রেইল সাইন দেওয়া পাবলিক বিল্ডিং — সবার জন্য ব্যবহারযোগ্য।
দৃষ্টি, শ্রবণ, মোটর এবং বুদ্ধিবৃত্তিক প্রতিবন্ধীদের জন্যও ডিজাইন করো। পর্যাপ্ত color contrast, বড় ফন্ট, ছবির alt text, screen reader support। Apple iOS এর VoiceOver এর সেরা উদাহরণ।
৭টি ভিজ্যুয়াল ডিজাইন কনসেপ্ট
৭. Hierarchy (অনুক্রম) — আকার, রঙ ও ব্যবধান দিয়ে চোখকে গুরুত্বপূর্ণ জিনিসের দিকে নিয়ে যাও। Amazon এর স্ক্রিনে চোখ স্বয়ংক্রিয়ভাবে: ছবি → শিরোনাম → দাম → "Cart-এ যোগ করুন" বোতামে যায়।
৮. Progressive Disclosure (ধীরে ধীরে প্রকাশ) — একসাথে সব না দেখিয়ে আগে প্রয়োজনীয়টা দেখাও। Airbnb প্রথমে শুধু location ও date দেখায়, advanced filter পরে।
৯. Contrast (বৈসাদৃশ্য) — text ও background এর রঙের পার্থক্য যেন যথেষ্ট থাকে। Google Search এটা ভালোভাবে করে, বিশেষ করে dark mode-এ।
১০. Proximity (নৈকট্য) — সম্পর্কিত জিনিস একসাথে রাখো। Instagram প্রতিটা পোস্টের নিচেই Like, Comment, Share রাখে।
১১. Alignment (সারিবদ্ধতা) — grid ব্যবহার করে সব কিছু সুশৃঙ্খলভাবে সাজাও। Spotify এর polished look এই কারণেই।
ডিজাইন টুলস
- Figma — cloud-based, real-time team collaboration
- Sketch — vector-based, wireframe ও mockup-এর জন্য জনপ্রিয়
- Adobe XD — interactive prototype, responsive design support
- InVision — stakeholder feedback ও user testing
- Axure RP — জটিল interactive prototype
📱 Adaptive ও Responsive Design
মূল সমস্যাটা কী?
তোমার অ্যাপ ছোট বাজেট ফোনে ব্যবহার হবে, বড় flagship ফোনে হবে, tablet-এও হবে। সব ডিভাইসে ভালো দেখাবে কীভাবে? দুটো পদ্ধতি আছে।
Responsive Design
বাস্তব উদাহরণ: পানি। লম্বা গ্লাস, চওড়া বাটি বা গোলাকার কাপ — যে পাত্রেই ঢালো, সে পাত্রের আকার নিয়ে নেয়।
Responsive design একটাই layout তৈরি করে যা flexible grid, fluid image ও CSS media query ব্যবহার করে যেকোনো স্ক্রিনে আপনা-আপনি মানিয়ে নেয়।
সুবিধা: একটাই codebase → maintain করা সহজ। Google-এর SEO-তে এগিয়ে থাকা যায়। অসুবিধা: ছোট স্ক্রিনেও সব element load করে → একটু slow হতে পারে।
Adaptive Design
বাস্তব উদাহরণ: দর্জির দোকানে আগে থেকে তৈরি কয়েকটা সাইজের পোশাক রাখা — কাস্টমার এলে মাপ অনুযায়ী সঠিক সাইজটা দেওয়া হয়।
Adaptive design ফোন, tablet, desktop-এর জন্য আলাদা আলাদা pre-built layout বানিয়ে রাখে। ডিভাইস detect করে সঠিক layout পাঠায়।
সুবিধা: দ্রুত (শুধু দরকারি জিনিস load হয়)। প্রতিটা ডিভাইসে precise control। অসুবিধা: একাধিক layout maintain করতে হয়। SEO জটিল হতে পারে।
কোনটা কখন বেছে নেবে?
| Responsive | Adaptive | |
|---|---|---|
| সেরা | Blog, নিউজ অ্যাপ, portfolio | গেম, performance-critical অ্যাপ |
| Codebase | একটা | একাধিক |
| Maintain | সহজ | কিছুটা কঠিন |
| Speed | একটু কম | বেশি |
| Control | কম precise | বেশি precise |
সহজ নিয়ম: flexibility ও broad reach চাইলে Responsive। performance ও precision চাইলে Adaptive।
মূল Technical কনসেপ্ট
Fluid vs Fixed Layout
- Fluid — percentage-based width (যেমন
width: 80%) — যেকোনো স্ক্রিনে মানিয়ে নেয় - Fixed — pixel-based width (যেমন
width: 360px) — স্ক্রিন যাই হোক একই থাকে
Breakpoints নির্দিষ্ট screen width-এ layout বদলায়। সাধারণ breakpoint: 480px (ছোট ফোন), 768px (tablet), 1024px (desktop)।
Device Detection (Adaptive) Server-side বা client-side logic দিয়ে কোন ডিভাইস তা detect করে সঠিক layout পাঠানো।
Flutter-এ Responsive ও Adaptive Widget
Responsive Widgets:
| Widget | কাজ |
|---|---|
MediaQuery |
স্ক্রিন সাইজ, orientation, pixel density জানা |
LayoutBuilder |
উপলব্ধ জায়গার উপর ভিত্তি করে widget তৈরি |
Flexible / Expanded |
Row/Column-এর ভেতরে child-এর সাইজ ঠিক করা |
Wrap |
child স্বয়ংক্রিয়ভাবে পরের লাইনে চলে যায় |
OrientationBuilder |
portrait ও landscape-এ আলাদা layout |
Adaptive Widgets:
| Widget | কাজ |
|---|---|
Platform.isAndroid / .isIOS |
কোন প্ল্যাটফর্ম তা detect করা |
CupertinoPageScaffold |
iOS স্টাইলের layout |
Scaffold |
Android/Material স্টাইলের layout |
Switch.adaptive |
প্ল্যাটফর্ম অনুযায়ী সঠিক switch দেখায় |
শেষ কথা — বড় ছবিটা
তিনটা লেকচার পড়ে যা বুঝলাম সেটা খুব স্পষ্ট। একটা ভালো মোবাইল অ্যাপ মানে শুধু ভালো কোড না — এর মানে হলো:
১. সঠিক আর্কিটেকচার — যেন অ্যাপ বড় হওয়ার সাথে সাথে ভেঙে না পড়ে ২. মানুষের জন্য ডিজাইন — যেন অ্যাপ সবার কাছে সহজবোধ্য ও সুন্দর হয় ৩. সব স্ক্রিনে মানিয়ে নেওয়া — বাজেট ফোন হোক বা tablet হোক
এগুলো শুধু পরীক্ষার টপিক না — এগুলোই সেই সিদ্ধান্ত যা মানুষের পছন্দের অ্যাপ আর ডিলিট করা অ্যাপের মধ্যে পার্থক্য তৈরি করে।
🌍 আমার সাথে যুক্ত থাকুন:
- ব্লগ: https://blog.naimurrashid.dev/
- পোর্টফোলিও: https://naimurrashid.dev/